[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-2985":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":19,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":24,"hasPages":22,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":32,"readmeContent":33,"aiSummary":34,"trendingCount":16,"starSnapshotCount":16,"syncStatus":35,"lastSyncTime":36,"discoverSource":37},2985,"highlight.js","highlightjs\u002Fhighlight.js","highlightjs","JavaScript syntax highlighter with language auto-detection and zero dependencies.","https:\u002F\u002Fhighlightjs.org\u002F",null,"JavaScript",24935,3725,295,140,0,6,31,3,76.1,"BSD 3-Clause \"New\" or \"Revised\" License",false,"main",true,[26,27,28,29,30,31],"hacktoberfest","highlighting","javascript","language-grammars","syntax-highlighter","syntax-highlighting","2026-06-12 04:00:16","# Highlight.js\n\n[![latest version](https:\u002F\u002Fbadgen.net\u002Fnpm\u002Fv\u002Fhighlight.js?label=latest)](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fhighlight.js)\n[![license](https:\u002F\u002Fbadgen.net\u002Fgithub\u002Flicense\u002Fhighlightjs\u002Fhighlight.js?color=cyan)](https:\u002F\u002Fgithub.com\u002Fhighlightjs\u002Fhighlight.js\u002Fblob\u002Fmain\u002FLICENSE)\n[![install size](https:\u002F\u002Fbadgen.net\u002Fpackagephobia\u002Finstall\u002Fhighlight.js?label=npm+install)](https:\u002F\u002Fpackagephobia.now.sh\u002Fresult?p=highlight.js)\n![minified](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fsize\u002Fhighlightjs\u002Fcdn-release\u002Fbuild\u002Fhighlight.min.js?label=minified)\n[![NPM downloads weekly](https:\u002F\u002Fbadgen.net\u002Fnpm\u002Fdw\u002Fhighlight.js?label=npm+downloads&color=purple)](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fhighlight.js)\n[![jsDelivr CDN downloads](https:\u002F\u002Fbadgen.net\u002Fjsdelivr\u002Fhits\u002Fgh\u002Fhighlightjs\u002Fcdn-release?label=jsDelivr+CDN&color=purple)](https:\u002F\u002Fwww.jsdelivr.com\u002Fpackage\u002Fgh\u002Fhighlightjs\u002Fcdn-release)\n\n[![ci status](https:\u002F\u002Fbadgen.net\u002Fgithub\u002Fchecks\u002Fhighlightjs\u002Fhighlight.js\u002Fmain?label=build)](https:\u002F\u002Fgithub.com\u002Fhighlightjs\u002Fhighlight.js\u002Factions\u002Fworkflows\u002Ftests.js.yml)\n[![CodeQL](https:\u002F\u002Fgithub.com\u002Fhighlightjs\u002Fhighlight.js\u002Fworkflows\u002FCodeQL\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Fhighlightjs\u002Fhighlight.js\u002Factions\u002Fworkflows\u002Fgithub-code-scanning\u002Fcodeql)\n[![vulnerabilities](https:\u002F\u002Fbadgen.net\u002Fsnyk\u002Fhighlightjs\u002Fhighlight.js)](https:\u002F\u002Fsnyk.io\u002Ftest\u002Fgithub\u002Fhighlightjs\u002Fhighlight.js?targetFile=package.json)\n\n[![discord](https:\u002F\u002Fbadgen.net\u002Fbadge\u002Ficon\u002Fdiscord?icon=discord&label&color=pink)](https:\u002F\u002Fdiscord.gg\u002FM24EbU7ja9)\n[![open issues](https:\u002F\u002Fbadgen.net\u002Fgithub\u002Fopen-issues\u002Fhighlightjs\u002Fhighlight.js?label=issues)](https:\u002F\u002Fgithub.com\u002Fhighlightjs\u002Fhighlight.js\u002Fissues)\n[![help welcome issues](https:\u002F\u002Fbadgen.net\u002Fgithub\u002Flabel-issues\u002Fhighlightjs\u002Fhighlight.js\u002Fhelp%20welcome\u002Fopen)](https:\u002F\u002Fgithub.com\u002Fhighlightjs\u002Fhighlight.js\u002Fissues?q=is%3Aopen+is%3Aissue+label%3A%22help+welcome%22)\n[![good first issue](https:\u002F\u002Fbadgen.net\u002Fgithub\u002Flabel-issues\u002Fhighlightjs\u002Fhighlight.js\u002Fgood%20first%20issue\u002Fopen)](https:\u002F\u002Fgithub.com\u002Fhighlightjs\u002Fhighlight.js\u002Fissues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22)\n\n\u003C!-- [![Build CI](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fworkflow\u002Fstatus\u002Fhighlightjs\u002Fhighlight.js\u002FNode.js%20CI)](https:\u002F\u002Fgithub.com\u002Fhighlightjs\u002Fhighlight.js\u002Factions?query=workflow%3A%22Node.js+CI%22) -->\n\u003C!-- [![commits since release](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fcommits-since\u002Fhighlightjs\u002Fhighlight.js\u002Flatest?label=commits+since)](https:\u002F\u002Fgithub.com\u002Fhighlightjs\u002Fhighlight.js\u002Fcommits\u002Fmain) -->\n\u003C!-- [![](https:\u002F\u002Fdata.jsdelivr.com\u002Fv1\u002Fpackage\u002Fgh\u002Fhighlightjs\u002Fcdn-release\u002Fbadge?style=rounded)](https:\u002F\u002Fwww.jsdelivr.com\u002Fpackage\u002Fgh\u002Fhighlightjs\u002Fcdn-release) -->\n\u003C!-- [![Total Lines](https:\u002F\u002Fimg.shields.io\u002Ftokei\u002Flines\u002Fgithub\u002Fhighlightjs\u002Fhighlight.js)]() -->\n\u003C!-- [![npm bundle size (minified + gzip)](https:\u002F\u002Fimg.shields.io\u002Fbundlephobia\u002Fminzip\u002Fhighlight.js.svg)](https:\u002F\u002Fbundlephobia.com\u002Fresult?p=highlight.js) -->\n\n\nHighlight.js is a syntax highlighter written in JavaScript. It works in\nthe browser as well as on the server. It can work with pretty much any\nmarkup, doesn’t depend on any other frameworks, and has automatic language\ndetection.\n\n**Contents**\n\n- [Basic Usage](#basic-usage)\n  - [In the Browser](#in-the-browser)\n    - [Plaintext Code Blocks](#plaintext-code-blocks)\n    - [Ignoring a Code Block](#ignoring-a-code-block)\n  - [Node.js on the Server](#nodejs-on-the-server)\n- [Supported Languages](#supported-languages)\n- [Custom Usage](#custom-usage)\n  - [Using custom HTML](#using-custom-html)\n  - [Using with Vue.js](#using-with-vuejs)\n  - [Using Web Workers](#using-web-workers)\n- [Importing the Library](#importing-the-library)\n  - [Node.js CommonJS Modules \u002F `require`](#nodejs-commonjs-modules--require)\n  - [Node.js ES6 Modules \u002F `import`](#nodejs-es6-modules--import)\n  - [Browser ES6 Modules](#browser-es6-modules)\n- [Getting the Library](#getting-the-library)\n  - [Fetch via CDN](#fetch-via-cdn)\n    - [cdnjs (link)](#cdnjs-link)\n    - [jsdelivr (link)](#jsdelivr-link)\n    - [unpkg (link)](#unpkg-link)\n  - [Download prebuilt CDN assets](#download-prebuilt-cdn-assets)\n  - [Download from our website](#download-from-our-website)\n  - [Install via NPM package](#install-via-npm-package)\n  - [Build from Source](#build-from-source)\n- [Requirements](#requirements)\n- [License](#license)\n- [Links](#links)\n\n---\n\n#### Upgrading to Version 11\n\nAs always, major releases do contain breaking changes which may require action from users.  Please read [VERSION_11_UPGRADE.md](https:\u002F\u002Fgithub.com\u002Fhighlightjs\u002Fhighlight.js\u002Fblob\u002Fmain\u002FVERSION_11_UPGRADE.md) for a detailed summary of breaking changes and any actions you may need to take.\n\n\n#### Support for older versions \u003C!-- omit in toc -->\n\nPlease see [SECURITY.md](https:\u002F\u002Fgithub.com\u002Fhighlightjs\u002Fhighlight.js\u002Fblob\u002Fmain\u002FSECURITY.md) for long-term support information.\n\n---\n\n## Basic Usage\n### In the Browser\n\nThe bare minimum for using highlight.js on a web page is linking to the\nlibrary along with one of the themes and calling [`highlightAll`][1]:\n\n```html\n\u003Clink rel=\"stylesheet\" href=\"\u002Fpath\u002Fto\u002Fstyles\u002Fdefault.min.css\">\n\u003Cscript src=\"\u002Fpath\u002Fto\u002Fhighlight.min.js\">\u003C\u002Fscript>\n\u003Cscript>hljs.highlightAll();\u003C\u002Fscript>\n```\n\nThis will find and highlight code inside of `\u003Cpre>\u003Ccode>` tags; it tries\nto detect the language automatically. If automatic detection doesn’t\nwork for you, or you simply prefer to be explicit, you can specify the language manually by using the `class` attribute:\n\n\n```html\n\u003Cpre>\u003Ccode class=\"language-html\">...\u003C\u002Fcode>\u003C\u002Fpre>\n```\n\n#### Plaintext Code Blocks\n\nTo apply the Highlight.js styling to plaintext without actually highlighting it, use the `plaintext` language:\n\n```html\n\u003Cpre>\u003Ccode class=\"language-plaintext\">...\u003C\u002Fcode>\u003C\u002Fpre>\n```\n\n#### Ignoring a Code Block\n\nTo skip highlighting of a code block completely, use the `nohighlight` class:\n\n```html\n\u003Cpre>\u003Ccode class=\"nohighlight\">...\u003C\u002Fcode>\u003C\u002Fpre>\n```\n\n### Node.js on the Server\n\nThe bare minimum to auto-detect the language and highlight some code.\n\n```js\n\u002F\u002F load the library and ALL languages\nhljs = require('highlight.js');\nhtml = hljs.highlightAuto('\u003Ch1>Hello World!\u003C\u002Fh1>').value\n```\n\nTo load only a \"common\" subset of popular languages:\n\n```js\nhljs = require('highlight.js\u002Flib\u002Fcommon');\n```\n\nTo highlight code with a specific language, use `highlight`:\n\n```js\nhtml = hljs.highlight('\u003Ch1>Hello World!\u003C\u002Fh1>', {language: 'xml'}).value\n```\n\nSee [Importing the Library](#importing-the-library) for more examples of `require` vs `import` usage, etc.  For more information about the result object returned by `highlight` or `highlightAuto` refer to the [api docs](https:\u002F\u002Fhighlightjs.readthedocs.io\u002Fen\u002Flatest\u002Fapi.html).\n\n\n\n## Supported Languages\n\nHighlight.js supports over 180 languages in the core library.  There are also 3rd party\nlanguage definitions available to support even more languages. You can find the full list of supported languages in [SUPPORTED_LANGUAGES.md][9].\n\n## Custom Usage\n\nIf you need a bit more control over the initialization of\nHighlight.js, you can use the [`highlightElement`][3] and [`configure`][4]\nfunctions. This allows you to better control *what* to highlight and *when*.\n\nFor example, here’s the rough equivalent of calling [`highlightAll`][1] but doing the work manually instead:\n\n```js\ndocument.addEventListener('DOMContentLoaded', (event) => {\n  document.querySelectorAll('pre code').forEach((el) => {\n    hljs.highlightElement(el);\n  });\n});\n```\n\nPlease refer to the documentation for [`configure`][4] options.\n\n\n### Using custom HTML\n\nWe strongly recommend `\u003Cpre>\u003Ccode>` wrapping for code blocks. It's quite\nsemantic and \"just works\" out of the box with zero fiddling. It is possible to\nuse other HTML elements (or combos), but you may need to pay special attention to\npreserving linebreaks.\n\nLet's say your markup for code blocks uses divs:\n\n```html\n\u003Cdiv class='code'>...\u003C\u002Fdiv>\n```\n\nTo highlight such blocks manually:\n\n```js\n\u002F\u002F first, find all the div.code blocks\ndocument.querySelectorAll('div.code').forEach(el => {\n  \u002F\u002F then highlight each\n  hljs.highlightElement(el);\n});\n```\n\nWithout using a tag that preserves linebreaks (like `pre`) you'll need some\nadditional CSS to help preserve them.  You could also [pre and post-process line\nbreaks with a plug-in][brPlugin], but *we recommend using CSS*.\n\n[brPlugin]: https:\u002F\u002Fgithub.com\u002Fhighlightjs\u002Fhighlight.js\u002Fissues\u002F2559\n\nTo preserve linebreaks inside a `div` using CSS:\n\n```css\ndiv.code {\n  white-space: pre;\n}\n```\n\n\n### Using with Vue.js\n\nSee [highlightjs\u002Fvue-plugin](https:\u002F\u002Fgithub.com\u002Fhighlightjs\u002Fvue-plugin) for a simple Vue plugin that works great with Highlight.js.\n\nAn example of `vue-plugin` in action:\n\n```html\n  \u003Cdiv id=\"app\">\n    \u003C!-- bind to a data property named `code` -->\n    \u003Chighlightjs autodetect :code=\"code\" \u002F>\n    \u003C!-- or literal code works as well -->\n    \u003Chighlightjs language='javascript' code=\"var x = 5;\" \u002F>\n  \u003C\u002Fdiv>\n```\n\n### Using Web Workers\n\nYou can run highlighting inside a web worker to avoid freezing the browser\nwindow while dealing with very big chunks of code.\n\nIn your main script:\n\n```js\naddEventListener('load', () => {\n  const code = document.querySelector('#code');\n  const worker = new Worker('worker.js');\n  worker.onmessage = (event) => { code.innerHTML = event.data; }\n  worker.postMessage(code.textContent);\n});\n```\n\nIn worker.js:\n\n```js\nonmessage = (event) => {\n  importScripts('\u003Cpath>\u002Fhighlight.min.js');\n  const result = self.hljs.highlightAuto(event.data);\n  postMessage(result.value);\n};\n```\n\n## Importing the Library\n\nFirst, you'll likely be installing the library via `npm` or `yarn` -- see [Getting the Library](#getting-the-library).\n\n\n### Node.js CommonJS Modules \u002F `require`\n\nRequiring the top-level library will load all languages:\n\n```js\n\u002F\u002F require the highlight.js library, including all languages\nconst hljs = require('.\u002Fhighlight.js');\nconst highlightedCode = hljs.highlightAuto('\u003Cspan>Hello World!\u003C\u002Fspan>').value\n```\n\nFor a smaller footprint, load our common subset of languages (the same set used for our default web build).\n\n```js\nconst hljs = require('highlight.js\u002Flib\u002Fcommon');\n```\n\nFor the smallest footprint, load only the languages you need:\n\n```js\nconst hljs = require('highlight.js\u002Flib\u002Fcore');\nhljs.registerLanguage('xml', require('highlight.js\u002Flib\u002Flanguages\u002Fxml'));\n\nconst highlightedCode = hljs.highlight('\u003Cspan>Hello World!\u003C\u002Fspan>', {language: 'xml'}).value\n```\n\n\n### Node.js ES6 Modules \u002F `import`\n\nThe default import will register all languages:\n\n```js\nimport hljs from 'highlight.js';\n```\n\nIt is more efficient to import only the library and register the languages you need:\n\n```js\nimport hljs from 'highlight.js\u002Flib\u002Fcore';\nimport javascript from 'highlight.js\u002Flib\u002Flanguages\u002Fjavascript';\nhljs.registerLanguage('javascript', javascript);\n```\n\nIf your build tool processes CSS imports, you can also import the theme directly as a module:\n\n```js\nimport hljs from 'highlight.js';\nimport 'highlight.js\u002Fstyles\u002Fgithub.css';\n```\n\n### Browser ES6 Modules\n\n*Note: For now you'll want to install `@highlightjs\u002Fcdn-assets` package instead of `highlight.js`.\nSee [Download prebuilt CDN assets](#download-prebuilt-cdn-assets)*\n\nTo import the library and register only those languages that you need:\n\n```js\nimport hljs from '.\u002Fassets\u002Fjs\u002F@highlightjs\u002Fcdn-assets\u002Fes\u002Fcore.js';\nimport javascript from '.\u002Fassets\u002Fjs\u002F@highlightjs\u002Fcdn-assets\u002Fes\u002Flanguages\u002Fjavascript.min.js';\n\nhljs.registerLanguage('javascript', javascript);\n```\n\nTo import the library and register all languages:\n\n```js\nimport hljs from '.\u002Fassets\u002Fjs\u002F@highlightjs\u002Fcdn-assets\u002Fes\u002Fhighlight.js';\n```\n\n*Note: The path to these files will vary depending on where you have installed\u002Fcopied them\nwithin your project or site. The above path is only an example.*\n\nYou can also use [`importmap`](https:\u002F\u002Fdeveloper.mozilla.org\u002Fen-US\u002Fdocs\u002FWeb\u002FHTML\u002FElement\u002Fscript\u002Ftype\u002Fimportmap) to import in similar way as Node:\n\n```html\n\u003Cscript type=\"importmap\">\n{\n\t\"imports\": {\n\t\t\"@highlightjs\": \".\u002Fassets\u002Fjs\u002F@highlightjs\u002Fcdn-assets\u002Fes\u002F\"\n\t}\n}\n\u003C\u002Fscript>\n```\n\nUse the above code in your HTML. After that, your JavaScript can import using the named key from\nyour `importmap`, for example `@highlightjs` in this case:\n\n```js\nimport hljs from '@highlightjs\u002Fcore.js';\nimport javascript from '@highlightjs\u002Flanguages\u002Fjavascript.min.js';\n\nhljs.registerLanguage('javascript', javascript);\n```\n\n*Note: You can also import directly from fully static URLs, such as our very own pre-built ES6 Module CDN resources. See [Fetch via CDN](#fetch-via-cdn) for specific examples.*\n\n\n## Getting the Library\n\nYou can get highlight.js as a hosted, or custom-build, browser script or\nas a server module. Right out of the box the browser script supports\nboth AMD and CommonJS, so if you wish you can use RequireJS or\nBrowserify without having to build from source. The server module also\nworks perfectly fine with Browserify, but there is the option to use a\nbuild specific to browsers rather than something meant for a server.\n\n\n**Do not link to GitHub directly.** The library is not supposed to work straight\nfrom the source, it requires building. If none of the pre-packaged options\nwork for you refer to the [building documentation][6].\n\n**On Almond.** You need to use the optimizer to give the module a name. For\nexample:\n\n```bash\nr.js -o name=hljs paths.hljs=\u002Fpath\u002Fto\u002Fhighlight out=highlight.js\n```\n\n### Fetch via CDN\n\nA prebuilt version of Highlight.js bundled with many common languages is hosted by several popular CDNs.\nWhen using Highlight.js via CDN you can use Subresource Integrity for additional security.  For details\nsee [DIGESTS.md](https:\u002F\u002Fgithub.com\u002Fhighlightjs\u002Fcdn-release\u002Fblob\u002Fmain\u002FDIGESTS.md).\n\n#### cdnjs ([link](https:\u002F\u002Fcdnjs.com\u002Flibraries\u002Fhighlight.js))\n\n##### Common JS \u003C!-- omit in toc -->\n\n```html\n\u003Clink rel=\"stylesheet\" href=\"https:\u002F\u002Fcdnjs.cloudflare.com\u002Fajax\u002Flibs\u002Fhighlight.js\u002F11.11.1\u002Fstyles\u002Fdefault.min.css\">\n\u003Cscript src=\"https:\u002F\u002Fcdnjs.cloudflare.com\u002Fajax\u002Flibs\u002Fhighlight.js\u002F11.11.1\u002Fhighlight.min.js\">\u003C\u002Fscript>\n\u003C!-- and it's easy to individually load additional languages -->\n\u003Cscript src=\"https:\u002F\u002Fcdnjs.cloudflare.com\u002Fajax\u002Flibs\u002Fhighlight.js\u002F11.11.1\u002Flanguages\u002Fgo.min.js\">\u003C\u002Fscript>\n```\n\n##### ES6 Modules \u003C!-- omit in toc -->\n\n````html\n\u003Clink rel=\"stylesheet\" href=\"https:\u002F\u002Fcdnjs.cloudflare.com\u002Fajax\u002Flibs\u002Fhighlight.js\u002F11.11.1\u002Fstyles\u002Fdark.min.css\">\n\u003Cscript type=\"module\">\nimport hljs from 'https:\u002F\u002Fcdnjs.cloudflare.com\u002Fajax\u002Flibs\u002Fhighlight.js\u002F11.11.1\u002Fes\u002Fhighlight.min.js';\n\u002F\u002F  and it's easy to individually load additional languages\nimport go from 'https:\u002F\u002Fcdnjs.cloudflare.com\u002Fajax\u002Flibs\u002Fhighlight.js\u002F11.11.1\u002Fes\u002Flanguages\u002Fgo.min.js';\nhljs.registerLanguage('go', go);\n\u003C\u002Fscript>\n\n````\n\n\n#### jsdelivr ([link](https:\u002F\u002Fwww.jsdelivr.com\u002Fpackage\u002Fgh\u002Fhighlightjs\u002Fcdn-release))\n\n##### Common JS \u003C!-- omit in toc -->\n\n```html\n\u003Clink rel=\"stylesheet\" href=\"https:\u002F\u002Fcdn.jsdelivr.net\u002Fgh\u002Fhighlightjs\u002Fcdn-release@11.11.1\u002Fbuild\u002Fstyles\u002Fdefault.min.css\">\n\u003Cscript src=\"https:\u002F\u002Fcdn.jsdelivr.net\u002Fgh\u002Fhighlightjs\u002Fcdn-release@11.11.1\u002Fbuild\u002Fhighlight.min.js\">\u003C\u002Fscript>\n\u003C!-- and it's easy to individually load additional languages -->\n\u003Cscript src=\"https:\u002F\u002Fcdn.jsdelivr.net\u002Fgh\u002Fhighlightjs\u002Fcdn-release@11.11.1\u002Fbuild\u002Flanguages\u002Fgo.min.js\">\u003C\u002Fscript>\n```\n\n##### ES6 Modules \u003C!-- omit in toc -->\n\n```html\n\u003Clink rel=\"stylesheet\" href=\"https:\u002F\u002Fcdn.jsdelivr.net\u002Fgh\u002Fhighlightjs\u002Fcdn-release@11.11.1\u002Fbuild\u002Fstyles\u002Fdefault.min.css\">\n\u003Cscript type=\"module\">\nimport hljs from 'https:\u002F\u002Fcdn.jsdelivr.net\u002Fgh\u002Fhighlightjs\u002Fcdn-release@11.11.1\u002Fbuild\u002Fes\u002Fhighlight.min.js';\n\u002F\u002F  and it's easy to individually load additional languages\nimport go from 'https:\u002F\u002Fcdn.jsdelivr.net\u002Fgh\u002Fhighlightjs\u002Fcdn-release@11.11.1\u002Fbuild\u002Fes\u002Flanguages\u002Fgo.min.js';\nhljs.registerLanguage('go', go);\n\u003C\u002Fscript>\n```\n\n#### unpkg ([link](https:\u002F\u002Funpkg.com\u002Fbrowse\u002F@highlightjs\u002Fcdn-assets\u002F))\n\n##### Common JS \u003C!-- omit in toc -->\n\n```html\n\u003Clink rel=\"stylesheet\" href=\"https:\u002F\u002Funpkg.com\u002F@highlightjs\u002Fcdn-assets@11.11.1\u002Fstyles\u002Fdefault.min.css\">\n\u003Cscript src=\"https:\u002F\u002Funpkg.com\u002F@highlightjs\u002Fcdn-assets@11.11.1\u002Fhighlight.min.js\">\u003C\u002Fscript>\n\u003C!-- and it's easy to individually load additional languages -->\n\u003Cscript src=\"https:\u002F\u002Funpkg.com\u002F@highlightjs\u002Fcdn-assets@11.11.1\u002Flanguages\u002Fgo.min.js\">\u003C\u002Fscript>\n```\n\n##### ES6 Modules \u003C!-- omit in toc -->\n\n```html\n\u003Clink rel=\"stylesheet\" href=\"https:\u002F\u002Funpkg.com\u002F@highlightjs\u002Fcdn-assets@11.11.1\u002Fstyles\u002Fdefault.min.css\">\n\u003Cscript type=\"module\">\nimport hljs from 'https:\u002F\u002Funpkg.com\u002F@highlightjs\u002Fcdn-assets@11.11.1\u002Fes\u002Fhighlight.min.js';\n\u002F\u002F  and it's easy to individually load & register additional languages\nimport go from 'https:\u002F\u002Funpkg.com\u002F@highlightjs\u002Fcdn-assets@11.11.1\u002Fes\u002Flanguages\u002Fgo.min.js';\nhljs.registerLanguage('go', go);\n\u003C\u002Fscript>\n```\n\n\n**Note:** *The CDN-hosted `highlight.min.js` package doesn't bundle every language.* It would be\nvery large. You can find our list of \"common\" languages that we bundle by default on our [download page][5].\n\n### Download prebuilt CDN assets\n\nYou can also download and self-host the same assets we serve up via our own CDNs.  We publish those builds to the [cdn-release](https:\u002F\u002Fgithub.com\u002Fhighlightjs\u002Fcdn-release) GitHub repository.  You can easily pull individual files off the CDN endpoints with `curl`, etc; if say you only needed `highlight.min.js` and a single CSS file.\n\nThere is also an npm package [@highlightjs\u002Fcdn-assets](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@highlightjs\u002Fcdn-assets) if pulling the assets in via `npm` or `yarn` would be easier for your build process.\n\n### Download from our website\n\nThe [download page][5] can quickly generate a custom single-file minified bundle including only the languages you desire.\n\n**Note:** [Building from source](#build-from-source) can produce slightly smaller builds than the website download.\n\n\n### Install via NPM package\n\nOur NPM package including all supported languages can be installed with NPM or Yarn:\n\n```bash\nnpm install highlight.js\n# or\nyarn add highlight.js\n```\n\nThere is also another npm package [@highlightjs\u002Fcdn-assets](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@highlightjs\u002Fcdn-assets) that contains prebuilt CDN assets including [ES6 Modules that can be imported in browser](#browser-es6-modules):\n\n```bash\nnpm install @highlightjs\u002Fcdn-assets\n# or\nyarn add @highlightjs\u002Fcdn-assets\n```\n\nAlternatively, you can build the NPM package from source.\n\n\n### Build from Source\n\nThe [current source code][10] is always available on GitHub.\n\n```bash\nnode tools\u002Fbuild.js -t node\nnode tools\u002Fbuild.js -t browser :common\nnode tools\u002Fbuild.js -t cdn :common\n```\n\nSee our [building documentation][6] for more information.\n\n\n## Requirements\n\nHighlight.js works on all modern browsers and currently supported Node.js versions.  You'll need the following software to contribute to the core library:\n\n- Node.js >= 12.x\n- npm >= 6.x\n\n## License\n\nHighlight.js is released under the BSD License. See our [LICENSE][7] file\nfor details.\n\n\n## Links\n\nThe official website for the library is \u003Chttps:\u002F\u002Fhighlightjs.org\u002F>.\n\nFurther in-depth documentation for the API and other topics is at\n\u003Chttp:\u002F\u002Fhighlightjs.readthedocs.io\u002F>.\n\nA list of the Core Team and contributors can be found in the [CONTRIBUTORS.md][8] file.\n\n[1]: http:\u002F\u002Fhighlightjs.readthedocs.io\u002Fen\u002Flatest\u002Fapi.html#highlightall\n[2]: http:\u002F\u002Fhighlightjs.readthedocs.io\u002Fen\u002Flatest\u002Fcss-classes-reference.html\n[3]: http:\u002F\u002Fhighlightjs.readthedocs.io\u002Fen\u002Flatest\u002Fapi.html#highlightelement\n[4]: http:\u002F\u002Fhighlightjs.readthedocs.io\u002Fen\u002Flatest\u002Fapi.html#configure\n[5]: https:\u002F\u002Fhighlightjs.org\u002Fdownload\u002F\n[6]: http:\u002F\u002Fhighlightjs.readthedocs.io\u002Fen\u002Flatest\u002Fbuilding-testing.html\n[7]: https:\u002F\u002Fgithub.com\u002Fhighlightjs\u002Fhighlight.js\u002Fblob\u002Fmain\u002FLICENSE\n[8]: https:\u002F\u002Fgithub.com\u002Fhighlightjs\u002Fhighlight.js\u002Fblob\u002Fmain\u002FCONTRIBUTORS.md\n[9]: https:\u002F\u002Fgithub.com\u002Fhighlightjs\u002Fhighlight.js\u002Fblob\u002Fmain\u002FSUPPORTED_LANGUAGES.md\n[10]: https:\u002F\u002Fgithub.com\u002Fhighlightjs\u002F\n","Highlight.js 是一个用 JavaScript 编写的语法高亮库，支持自动检测语言且无需任何依赖。其核心功能包括对多种编程语言的语法进行高亮显示，并能在浏览器和服务器端运行。技术特点在于其轻量级、易于集成以及丰富的语言支持。适用于需要在网页或应用中展示代码块并提升代码可读性的场景，如技术博客、文档系统或是在线代码编辑器等。",2,"2026-06-11 02:52:03","top_language"]