برنامه نویسی

روز 19: آنها را برجسته کنید! 🔖

Summarize this content to 400 words in Persian Lang امروز می خواهم یک کتابخانه کوچک زیبا را با شما به اشتراک بگذارم که خروجی کد مانند را رنگ آمیزی می کند. بله، امروز بدون شوخی، کتابخانه بسیار جدی: cli-highlight👔.

شما می دانید مته: نصب با به عنوان مثال deno add npm:cli-highlight و ایجاد یک فایل، به عنوان مثال main.ts:

import { highlight } from “cli-highlight”;

const code = JSON.stringify(
[
{
category: “Christmas”,
jokes: [
{
question: “What do you call Santa when he stops moving?”,
answer: “Santa Pause!”,
},
{
question: “Why did the Christmas tree go to therapy?”,
answer: “It had too many hang-ups!”,
},
],
},
{
category: “Winter”,
jokes: [
{
question: “How do snowmen get around?”,
answer: “By riding an *icicle*!”,
},
],
},
{
category: “Gifts”,
jokes: [
{
question: “What do you call a bankrupt Santa?”,
answer: “Saint *Nickel*-less!”,
},
{
question: “Why was the gift so good at music?”,
answer: “It had great *wrap* skills!”,
},
],
},
],
null,
2
);

console.log(highlight(code, { language: “json” }));

اجرا با deno run -A ./main.ts و از خروجی خوانا لذت ببرید:

از 192 زبان پشتیبانی می کند، درست مانند برجسته کننده مرورگر:

[
“1c”,
“abnf”,
“accesslog”,
“actionscript”,
“ada”,
“angelscript”,
“apache”,
“applescript”,
“arcade”,
“arduino”,
“armasm”,
“asciidoc”,
“aspectj”,
“autohotkey”,
“autoit”,
“avrasm”,
“awk”,
“axapta”,
“bash”,
“basic”,
“bnf”,
“brainfuck”,
“c”,
“cal”,
“capnproto”,
“ceylon”,
“clean”,
“clojure-repl”,
“clojure”,
“cmake”,
“coffeescript”,
“coq”,
“cos”,
“cpp”,
“crmsh”,
“crystal”,
“csharp”,
“csp”,
“css”,
“d”,
“dart”,
“delphi”,
“diff”,
“django”,
“dns”,
“dockerfile”,
“dos”,
“dsconfig”,
“dts”,
“dust”,
“ebnf”,
“elixir”,
“elm”,
“erb”,
“erlang-repl”,
“erlang”,
“excel”,
“fix”,
“flix”,
“fortran”,
“fsharp”,
“gams”,
“gauss”,
“gcode”,
“gherkin”,
“glsl”,
“gml”,
“go”,
“golo”,
“gradle”,
“graphql”,
“groovy”,
“haml”,
“handlebars”,
“haskell”,
“haxe”,
“hsp”,
“http”,
“hy”,
“inform7”,
“ini”,
“irpf90”,
“isbl”,
“java”,
“javascript”,
“jboss-cli”,
“json”,
“julia-repl”,
“julia”,
“kotlin”,
“lasso”,
“latex”,
“ldif”,
“leaf”,
“less”,
“lisp”,
“livecodeserver”,
“livescript”,
“llvm”,
“lsl”,
“lua”,
“makefile”,
“markdown”,
“mathematica”,
“matlab”,
“maxima”,
“mel”,
“mercury”,
“mipsasm”,
“mizar”,
“mojolicious”,
“monkey”,
“moonscript”,
“n1ql”,
“nestedtext”,
“nginx”,
“nim”,
“nix”,
“node-repl”,
“nsis”,
“objectivec”,
“ocaml”,
“openscad”,
“oxygene”,
“parser3”,
“perl”,
“pf”,
“pgsql”,
“php-template”,
“php”,
“plaintext”,
“pony”,
“powershell”,
“processing”,
“profile”,
“prolog”,
“properties”,
“protobuf”,
“puppet”,
“purebasic”,
“python-repl”,
“python”,
“q”,
“qml”,
“r”,
“reasonml”,
“rib”,
“roboconf”,
“routeros”,
“rsl”,
“ruby”,
“ruleslanguage”,
“rust”,
“sas”,
“scala”,
“scheme”,
“scilab”,
“scss”,
“shell”,
“smali”,
“smalltalk”,
“sml”,
“sqf”,
“sql”,
“stan”,
“stata”,
“step21”,
“stylus”,
“subunit”,
“swift”,
“taggerscript”,
“tap”,
“tcl”,
“thrift”,
“tp”,
“twig”,
“typescript”,
“vala”,
“vbnet”,
“vbscript-html”,
“vbscript”,
“verilog”,
“vhdl”,
“vim”,
“wasm”,
“wren”,
“x86asm”,
“xl”,
“xml”,
“xquery”,
“yaml”,
“zephir”
]

محتوا را دوست داشتید و دوست دارید در طول سال بیشتر از آن استفاده کنید؟

امروز می خواهم یک کتابخانه کوچک زیبا را با شما به اشتراک بگذارم که خروجی کد مانند را رنگ آمیزی می کند. بله، امروز بدون شوخی، کتابخانه بسیار جدی: cli-highlight👔.

شما می دانید مته: نصب با به عنوان مثال deno add npm:cli-highlight و ایجاد یک فایل، به عنوان مثال main.ts:

import { highlight } from "cli-highlight";

const code = JSON.stringify(
  [
    {
      category: "Christmas",
      jokes: [
        {
          question: "What do you call Santa when he stops moving?",
          answer: "Santa Pause!",
        },
        {
          question: "Why did the Christmas tree go to therapy?",
          answer: "It had too many hang-ups!",
        },
      ],
    },
    {
      category: "Winter",
      jokes: [
        {
          question: "How do snowmen get around?",
          answer: "By riding an *icicle*!",
        },
      ],
    },
    {
      category: "Gifts",
      jokes: [
        {
          question: "What do you call a bankrupt Santa?",
          answer: "Saint *Nickel*-less!",
        },
        {
          question: "Why was the gift so good at music?",
          answer: "It had great *wrap* skills!",
        },
      ],
    },
  ],
  null,
  2
);

console.log(highlight(code, { language: "json" }));

اجرا با deno run -A ./main.ts و از خروجی خوانا لذت ببرید:

JSON با خواص و مقادیر رنگی

از 192 زبان پشتیبانی می کند، درست مانند برجسته کننده مرورگر:

[
    "1c",
    "abnf",
    "accesslog",
    "actionscript",
    "ada",
    "angelscript",
    "apache",
    "applescript",
    "arcade",
    "arduino",
    "armasm",
    "asciidoc",
    "aspectj",
    "autohotkey",
    "autoit",
    "avrasm",
    "awk",
    "axapta",
    "bash",
    "basic",
    "bnf",
    "brainfuck",
    "c",
    "cal",
    "capnproto",
    "ceylon",
    "clean",
    "clojure-repl",
    "clojure",
    "cmake",
    "coffeescript",
    "coq",
    "cos",
    "cpp",
    "crmsh",
    "crystal",
    "csharp",
    "csp",
    "css",
    "d",
    "dart",
    "delphi",
    "diff",
    "django",
    "dns",
    "dockerfile",
    "dos",
    "dsconfig",
    "dts",
    "dust",
    "ebnf",
    "elixir",
    "elm",
    "erb",
    "erlang-repl",
    "erlang",
    "excel",
    "fix",
    "flix",
    "fortran",
    "fsharp",
    "gams",
    "gauss",
    "gcode",
    "gherkin",
    "glsl",
    "gml",
    "go",
    "golo",
    "gradle",
    "graphql",
    "groovy",
    "haml",
    "handlebars",
    "haskell",
    "haxe",
    "hsp",
    "http",
    "hy",
    "inform7",
    "ini",
    "irpf90",
    "isbl",
    "java",
    "javascript",
    "jboss-cli",
    "json",
    "julia-repl",
    "julia",
    "kotlin",
    "lasso",
    "latex",
    "ldif",
    "leaf",
    "less",
    "lisp",
    "livecodeserver",
    "livescript",
    "llvm",
    "lsl",
    "lua",
    "makefile",
    "markdown",
    "mathematica",
    "matlab",
    "maxima",
    "mel",
    "mercury",
    "mipsasm",
    "mizar",
    "mojolicious",
    "monkey",
    "moonscript",
    "n1ql",
    "nestedtext",
    "nginx",
    "nim",
    "nix",
    "node-repl",
    "nsis",
    "objectivec",
    "ocaml",
    "openscad",
    "oxygene",
    "parser3",
    "perl",
    "pf",
    "pgsql",
    "php-template",
    "php",
    "plaintext",
    "pony",
    "powershell",
    "processing",
    "profile",
    "prolog",
    "properties",
    "protobuf",
    "puppet",
    "purebasic",
    "python-repl",
    "python",
    "q",
    "qml",
    "r",
    "reasonml",
    "rib",
    "roboconf",
    "routeros",
    "rsl",
    "ruby",
    "ruleslanguage",
    "rust",
    "sas",
    "scala",
    "scheme",
    "scilab",
    "scss",
    "shell",
    "smali",
    "smalltalk",
    "sml",
    "sqf",
    "sql",
    "stan",
    "stata",
    "step21",
    "stylus",
    "subunit",
    "swift",
    "taggerscript",
    "tap",
    "tcl",
    "thrift",
    "tp",
    "twig",
    "typescript",
    "vala",
    "vbnet",
    "vbscript-html",
    "vbscript",
    "verilog",
    "vhdl",
    "vim",
    "wasm",
    "wren",
    "x86asm",
    "xl",
    "xml",
    "xquery",
    "yaml",
    "zephir"
]

محتوا را دوست داشتید و دوست دارید در طول سال بیشتر از آن استفاده کنید؟

برای من یک قهوه بخر

نوشته های مشابه

دیدگاهتان را بنویسید

نشانی ایمیل شما منتشر نخواهد شد. بخش‌های موردنیاز علامت‌گذاری شده‌اند *

دکمه بازگشت به بالا