{"_id":"@0xecho/highlight.js","_rev":"1-c8f84574decb371d339c37388e9dceee","name":"@0xecho/highlight.js","dist-tags":{"latest":"11.6.1"},"versions":{"11.6.0":{"name":"@0xecho/highlight.js","description":"Syntax highlighting with language autodetection.","keywords":["highlight","syntax"],"homepage":"https://highlightjs.org/","version":"11.6.0","author":{"name":"Josh Goebel","email":"hello@joshgoebel.com"},"contributors":[{"name":"Josh Goebel","email":"hello@joshgoebel.com"},{"name":"Egor Rogov","email":"e.rogov@postgrespro.ru"},{"name":"Vladimir Jimenez","email":"me@allejo.io"},{"name":"Ivan Sagalaev","email":"maniac@softwaremaniacs.org"},{"name":"Jeremy Hull","email":"sourdrums@gmail.com"},{"name":"Oleg Efimov","email":"efimovov@gmail.com"},{"name":"Gidi Meir Morris","email":"gidi@gidi.io"},{"name":"Jan T. Sott","email":"git@idleberg.com"},{"name":"Li Xuanji","email":"xuanji@gmail.com"},{"name":"Marcos Cáceres","email":"marcos@marcosc.com"},{"name":"Sang Dang","email":"sang.dang@polku.io"}],"bugs":{"url":"https://github.com/highlightjs/highlight.js/issues"},"license":"BSD-3-Clause","repository":{"type":"git","url":"git://github.com/highlightjs/highlight.js.git"},"type":"commonjs","main":"./lib/index.js","types":"./types/index.d.ts","sideEffects":["*.css","*.scss"],"scripts":{"mocha":"mocha","lint":"eslint src/*.js src/lib/*.js demo/*.js tools/**/*.js --ignore-pattern vendor","lint-languages":"eslint --no-eslintrc -c .eslintrc.lang.js src/languages/**/*.js","build_and_test":"npm run build && npm run test","build_and_test_browser":"npm run build-browser && npm run test-browser","build":"node ./tools/build.js -t node","build-cdn":"node ./tools/build.js -t cdn","build-browser":"node ./tools/build.js -t browser :common","test":"mocha test","test-markup":"mocha test/markup","test-detect":"mocha test/detect","test-browser":"mocha test/browser","test-parser":"mocha test/parser"},"engines":{"node":">=12.0.0"},"devDependencies":{"@colors/colors":"^1.5.0","@rollup/plugin-commonjs":"^22.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^13.3.0","@types/mocha":"^9.1.1","@typescript-eslint/eslint-plugin":"^5.27.1","@typescript-eslint/parser":"^5.27.1","clean-css":"^5.3.0","cli-table":"^0.3.1","commander":"9.3","css":"^3.0.0","css-color-names":"^1.0.1","deep-freeze-es6":"^1.4.1","del":"^6.1.1","dependency-resolver":"^2.0.1","eslint":"^8.17.0","eslint-config-standard":"^17.0.0","eslint-plugin-import":"^2.26.0","eslint-plugin-node":"^11.1.0","eslint-plugin-promise":"^6.0.0","glob":"^7.2.3","glob-promise":"^4.2.2","handlebars":"^4.7.6","jsdom":"^20.0.0","lodash":"^4.17.20","mocha":"^10.0.0","refa":"^0.4.1","rollup":"^2.47.0","should":"^13.2.3","terser":"^5.14.1","tiny-worker":"^2.3.0","typescript":"^4.7.3","wcag-contrast":"^3.0.0"},"exports":{".":{"require":"./lib/index.js","import":"./es/index.js"},"./package.json":"./package.json","./lib/common":{"require":"./lib/common.js","import":"./es/common.js"},"./lib/core":{"require":"./lib/core.js","import":"./es/core.js"},"./lib/languages/*":{"require":"./lib/languages/*.js","import":"./es/languages/*.js"},"./scss/*":"./scss/*","./styles/*":"./styles/*","./types/*":"./types/*"},"gitHead":"3209cca58146c1287123c3d3bb3eb982174d64fd","_id":"@0xecho/highlight.js@11.6.0","_nodeVersion":"16.15.0","_npmVersion":"8.5.5","dist":{"integrity":"sha512-ktS4aKNKeWzbyGkKpQimd2LieGXL7ySt+HZYh6ZQRKvGoQkPAMaf6lXlIOMOesNscDtyhGbn3HFBucWz3fQRRA==","shasum":"97392a98c9ea9f9f801121a90b9a3adde6e85945","tarball":"https://registry.npmjs.org/@0xecho/highlight.js/-/highlight.js-11.6.0.tgz","fileCount":1287,"unpackedSize":3911629,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICqQ+giT5+ieLCK5rjTUZfpF+lA4z8/EXV9E6lZEeh3HAiAwWD3mY/BVOUt62BzFiq998Gix+yutZav5vTU3UKXo7Q=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi+GT0ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr3Qw/9F3YcfH0AA0WQfYtfFliEHyl05ABtTBq60co5cyuNA10ubW9g\r\nR6NKtXBZdpL6ULyKAIbxbewP/fW/tfxAgZaTkMZVG2XG8vprzUixHlks4Fk1\r\n2JkjwT7XnKUpdM5YbISgYdV9C8+WTZ2436q0luV/EAMd+NviSIHXa0AeVaQ3\r\n7Ss9xBD+h1CK2fw35QF3ZsPTGR/IUbnO3tRVp134LWjK8tY8JsrGi49sixdX\r\nVqjHDxRe7bluP0JMVUJyIl8AlYQUtWbUUb9IhwJtqDLp7U6lzL2vSKaeGeYL\r\n+DfcnwCRiP5piAoRIkafNdOP12+87tCIZ/EQUPJUAH2vZryA2TmAgdIVPkl2\r\nyCbX6LlOjTXL6q9xzmpaKAY767On/JFMbby3OAiW7Z0u7wmSMkzhOMAWSfrQ\r\n+msTJNIqbhCBAVrs7lNH9h2OFs/WJbaFIxUAtuyWy4CEdpWuRIntAqwzUyn2\r\ngTdESzgBKkZ977bG/mKcdinObEhuqvA3JZK9K8E5fOu1xwD6hsWp0DokTAv8\r\nR5v+2gldamvzOQYevVj2v6iyd3D/fhuWEHRo9Y0/vUbG/iCfQ2HS5Kmav7Do\r\nay4Im77DQkXUsznOvVsq8qiFpuCwEDxdHPXt2rUUfvhnJ5IsXSeh73+HTqwc\r\nhNduoZaJMFjkf6Dwcs69g2HgPiuuGkQS7tk=\r\n=oele\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"airyland","email":"airyland@qq.com"},"directories":{},"maintainers":[{"name":"airyland","email":"airyland@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/highlight.js_11.6.0_1660445939779_0.10632619523931841"},"_hasShrinkwrap":false},"11.6.1":{"name":"@0xecho/highlight.js","description":"Syntax highlighting with language autodetection.","keywords":["highlight","syntax"],"homepage":"https://highlightjs.org/","version":"11.6.1","author":{"name":"Josh Goebel","email":"hello@joshgoebel.com"},"contributors":[{"name":"Josh Goebel","email":"hello@joshgoebel.com"},{"name":"Egor Rogov","email":"e.rogov@postgrespro.ru"},{"name":"Vladimir Jimenez","email":"me@allejo.io"},{"name":"Ivan Sagalaev","email":"maniac@softwaremaniacs.org"},{"name":"Jeremy Hull","email":"sourdrums@gmail.com"},{"name":"Oleg Efimov","email":"efimovov@gmail.com"},{"name":"Gidi Meir Morris","email":"gidi@gidi.io"},{"name":"Jan T. Sott","email":"git@idleberg.com"},{"name":"Li Xuanji","email":"xuanji@gmail.com"},{"name":"Marcos Cáceres","email":"marcos@marcosc.com"},{"name":"Sang Dang","email":"sang.dang@polku.io"}],"bugs":{"url":"https://github.com/highlightjs/highlight.js/issues"},"license":"BSD-3-Clause","repository":{"type":"git","url":"git://github.com/highlightjs/highlight.js.git"},"type":"commonjs","main":"./lib/index.js","types":"./types/index.d.ts","sideEffects":["*.css","*.scss"],"scripts":{"mocha":"mocha","lint":"eslint src/*.js src/lib/*.js demo/*.js tools/**/*.js --ignore-pattern vendor","lint-languages":"eslint --no-eslintrc -c .eslintrc.lang.js src/languages/**/*.js","build_and_test":"npm run build && npm run test","build_and_test_browser":"npm run build-browser && npm run test-browser","build":"node ./tools/build.js -t node","build-cdn":"node ./tools/build.js -t cdn","build-browser":"node ./tools/build.js -t browser :common","test":"mocha test","test-markup":"mocha test/markup","test-detect":"mocha test/detect","test-browser":"mocha test/browser","test-parser":"mocha test/parser"},"engines":{"node":">=12.0.0"},"devDependencies":{"@colors/colors":"^1.5.0","@rollup/plugin-commonjs":"^22.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^13.3.0","@types/mocha":"^9.1.1","@typescript-eslint/eslint-plugin":"^5.27.1","@typescript-eslint/parser":"^5.27.1","clean-css":"^5.3.0","cli-table":"^0.3.1","commander":"9.3","css":"^3.0.0","css-color-names":"^1.0.1","deep-freeze-es6":"^1.4.1","del":"^6.1.1","dependency-resolver":"^2.0.1","eslint":"^8.17.0","eslint-config-standard":"^17.0.0","eslint-plugin-import":"^2.26.0","eslint-plugin-node":"^11.1.0","eslint-plugin-promise":"^6.0.0","glob":"^7.2.3","glob-promise":"^4.2.2","handlebars":"^4.7.6","jsdom":"^20.0.0","lodash":"^4.17.20","mocha":"^10.0.0","refa":"^0.4.1","rollup":"^2.47.0","should":"^13.2.3","terser":"^5.14.1","tiny-worker":"^2.3.0","typescript":"^4.7.3","wcag-contrast":"^3.0.0"},"exports":{".":{"require":"./lib/index.js","import":"./es/index.js"},"./package.json":"./package.json","./lib/common":{"require":"./lib/common.js","import":"./es/common.js"},"./lib/core":{"require":"./lib/core.js","import":"./es/core.js"},"./lib/languages/*":{"require":"./lib/languages/*.js","import":"./es/languages/*.js"},"./scss/*":"./scss/*","./styles/*":"./styles/*","./types/*":"./types/*"},"gitHead":"3209cca58146c1287123c3d3bb3eb982174d64fd","_id":"@0xecho/highlight.js@11.6.1","_nodeVersion":"16.15.0","_npmVersion":"8.5.5","dist":{"integrity":"sha512-n7qAtoeEgKxA0MGMIdBdPoeSpQDVEeOnTdEaVjx1liHtf5JCY32jUIHbzPgrK0qoxvQfBKpouyLxuUJ+Io/8eg==","shasum":"296e897a8903de18944f28ea6cc9dabca15ae3af","tarball":"https://registry.npmjs.org/@0xecho/highlight.js/-/highlight.js-11.6.1.tgz","fileCount":1287,"unpackedSize":3911635,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGWNJ3mdWIqVc4wqX9Eh95QCBYHt8STYMPf1Zd3PeGEjAiBnJviEdqW1dnx/K8OlrJ8RSd74/zv3VvnUOhyciHnUdA=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi+Gc0ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqXbQ//ZX5wEdi6NLpOV7UjtNDR/bbeeZxZ1Q18Iwcluug1alPdEmpJ\r\n6wiUsfvaR+MKcGes0QVMV1lrk5J6wTFJpnO0lCi3wCiEaFp+xf1I5Z2/YhFB\r\nRXc2LKPwbPgzD6Ex4xDob22PtVyjRZFg23iRSWvvE+AllDWO2A7qi03tzoIQ\r\nYlmEKbKHJVxcPFSDL2hv53kuV12hjzSLfwT+1+o92TH6WraHM8ecqeviQhaX\r\noMZRHNfW/67c0jxE9JLjA5fetnYQHnIeKCDQYwu6KVkmQgTVH83Yvc0xYnq5\r\nhHjLw/9bXycY5IcxNJtom6qyOk0gzm4HKcg9hVx/4mWbIpJzwaL7x2b6L4+x\r\nUr90atWeECBqrwSGiuiQeQRMQbeNauAOckPsOqHRE36K+aFZRdZzm5TjsudY\r\ngX0CzY1i3HK82fUAAzZa1m/+ouXNqlhfU6kqAHuw0jlKrXmmMvWYZV/SqDGh\r\ntX5AIIUyFrnh50M5Zdsbw77QOXqea6n8psWpOrG5oCImP/EoPRTI/Yd/BPYA\r\nk8jxXTkSaKs0o4c2cnAQL5pPNJqBv5uRbxGt6v9eRGgNwN1CV8SUs9IBS//3\r\n6nLCoZVQpfpLmLxhom5dGx6E/tnTuxELveYa3rM1RYw84irlc8zz2rSoE67H\r\nJV+rAq7UEfSaobnvyuBXb+gpAGb8t6KosNA=\r\n=EjZf\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"airyland","email":"airyland@qq.com"},"directories":{},"maintainers":[{"name":"airyland","email":"airyland@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/highlight.js_11.6.1_1660446516304_0.0373487149998013"},"_hasShrinkwrap":false}},"time":{"created":"2022-08-14T02:58:59.729Z","11.6.0":"2022-08-14T02:59:00.114Z","modified":"2022-08-14T03:08:36.872Z","11.6.1":"2022-08-14T03:08:36.785Z"},"maintainers":[{"name":"airyland","email":"airyland@qq.com"}],"description":"Syntax highlighting with language autodetection.","homepage":"https://highlightjs.org/","keywords":["highlight","syntax"],"repository":{"type":"git","url":"git://github.com/highlightjs/highlight.js.git"},"contributors":[{"name":"Josh Goebel","email":"hello@joshgoebel.com"},{"name":"Egor Rogov","email":"e.rogov@postgrespro.ru"},{"name":"Vladimir Jimenez","email":"me@allejo.io"},{"name":"Ivan Sagalaev","email":"maniac@softwaremaniacs.org"},{"name":"Jeremy Hull","email":"sourdrums@gmail.com"},{"name":"Oleg Efimov","email":"efimovov@gmail.com"},{"name":"Gidi Meir Morris","email":"gidi@gidi.io"},{"name":"Jan T. Sott","email":"git@idleberg.com"},{"name":"Li Xuanji","email":"xuanji@gmail.com"},{"name":"Marcos Cáceres","email":"marcos@marcosc.com"},{"name":"Sang Dang","email":"sang.dang@polku.io"}],"author":{"name":"Josh Goebel","email":"hello@joshgoebel.com"},"bugs":{"url":"https://github.com/highlightjs/highlight.js/issues"},"license":"BSD-3-Clause","readme":"# Highlight.js\n\n[![latest version](https://badgen.net/npm/v/highlight.js?label=latest)](https://www.npmjs.com/package/highlight.js)\n[![license](https://badgen.net/github/license/highlightjs/highlight.js?color=cyan)](https://github.com/highlightjs/highlight.js/blob/main/LICENSE)\n[![install size](https://badgen.net/packagephobia/install/highlight.js?label=npm+install)](https://packagephobia.now.sh/result?p=highlight.js)\n![minified](https://img.shields.io/github/size/highlightjs/cdn-release/build/highlight.min.js?label=minified)\n[![NPM downloads weekly](https://badgen.net/npm/dw/highlight.js?label=npm+downloads&color=purple)](https://www.npmjs.com/package/highlight.js)\n[![jsDelivr CDN downloads](https://badgen.net/jsdelivr/hits/gh/highlightjs/cdn-release?label=jsDelivr+CDN&color=purple)](https://www.jsdelivr.com/package/gh/highlightjs/cdn-release)\n\n<!-- [![build and CI status](https://badgen.net/github/checks/highlightjs/highlight.js?label=build)](https://github.com/highlightjs/highlight.js/actions?query=workflow%3A%22Node.js+CI%22) -->\n![build and CI status](https://badgen.net/github/checks/highlightjs/highlight.js/main?label=build)\n[![code quality](https://badgen.net/lgtm/grade/g/highlightjs/highlight.js/js?label=code+quality)](https://lgtm.com/projects/g/highlightjs/highlight.js/?mode=list)\n[![vulnerabilities](https://badgen.net/snyk/highlightjs/highlight.js)](https://snyk.io/test/github/highlightjs/highlight.js?targetFile=package.json)\n![dev deps](https://badgen.net/david/dev/highlightjs/highlight.js?label=dev+deps)\n\n\n[![discord](https://badgen.net/badge/icon/discord?icon=discord&label&color=pink)](https://discord.gg/M24EbU7ja9)\n[![open issues](https://badgen.net/github/open-issues/highlightjs/highlight.js?label=issues)](https://github.com/highlightjs/highlight.js/issues)\n[![help welcome issues](https://badgen.net/github/label-issues/highlightjs/highlight.js/help%20welcome/open)](https://github.com/highlightjs/highlight.js/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+welcome%22)\n[![good first issue](https://badgen.net/github/label-issues/highlightjs/highlight.js/good%20first%20issue/open)](https://github.com/highlightjs/highlight.js/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22)\n\n<!-- [![Build CI](https://img.shields.io/github/workflow/status/highlightjs/highlight.js/Node.js%20CI)](https://github.com/highlightjs/highlight.js/actions?query=workflow%3A%22Node.js+CI%22) -->\n<!-- [![commits since release](https://img.shields.io/github/commits-since/highlightjs/highlight.js/latest?label=commits+since)](https://github.com/highlightjs/highlight.js/commits/main) -->\n<!-- [![](https://data.jsdelivr.com/v1/package/gh/highlightjs/cdn-release/badge?style=rounded)](https://www.jsdelivr.com/package/gh/highlightjs/cdn-release) -->\n<!-- [![Total Lines](https://img.shields.io/tokei/lines/github/highlightjs/highlight.js)]() -->\n<!-- [![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/highlight.js.svg)](https://bundlephobia.com/result?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 / `require`](#nodejs--require)\n  - [ES6 Modules / `import`](#es6-modules--import)\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://github.com/highlightjs/highlight.js/blob/main/VERSION_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 <!-- omit in toc -->\n\nPlease see [SECURITY.md](https://github.com/highlightjs/highlight.js/blob/main/SECURITY.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<link rel=\"stylesheet\" href=\"/path/to/styles/default.min.css\">\n<script src=\"/path/to/highlight.min.js\"></script>\n<script>hljs.highlightAll();</script>\n```\n\nThis will find and highlight code inside of `<pre><code>` 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 in the using the `class` attribute:\n\n\n```html\n<pre><code class=\"language-html\">...</code></pre>\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<pre><code class=\"language-plaintext\">...</code></pre>\n```\n\n#### Ignoring a Code Block\n\nTo skip highlighting of a code block completely, use the `nohighlight` class:\n\n```html\n<pre><code class=\"nohighlight\">...</code></pre>\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// load the library and ALL languages\nhljs = require('highlight.js');\nhtml = hljs.highlightAuto('<h1>Hello World!</h1>').value\n```\n\nTo load only a \"common\" subset of popular languages:\n\n```js\nhljs = require('highlight.js/lib/common');\n```\n\nTo highlight code with a specific language, use `highlight`:\n\n```js\nhtml = hljs.highlight('<h1>Hello World!</h1>', {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://highlightjs.readthedocs.io/en/latest/api.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 `<pre><code>` 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<div class='code'>...</div>\n```\n\nTo highlight such blocks manually:\n\n```js\n// first, find all the div.code blocks\ndocument.querySelectorAll('div.code').forEach(el => {\n  // 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://github.com/highlightjs/highlight.js/issues/2559\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/vue-plugin](https://github.com/highlightjs/vue-plugin) for a simple Vue plugin that works great with Highlight.js.\n\nAn example of `vue-plugin` in action:\n\n```html\n  <div id=\"app\">\n    <!-- bind to a data property named `code` -->\n    <highlightjs autodetect :code=\"code\" />\n    <!-- or literal code works as well -->\n    <highlightjs language='javascript' code=\"var x = 5;\" />\n  </div>\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('<path>/highlight.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 / `require`\n\nRequiring the top-level library will load all languages:\n\n```js\n// require the highlight.js library, including all languages\nconst hljs = require('./highlight.js');\nconst highlightedCode = hljs.highlightAuto('<span>Hello World!</span>').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/lib/common');\n```\n\nFor the smallest footprint, load only the languages you need:\n\n```js\nconst hljs = require('highlight.js/lib/core');\nhljs.registerLanguage('xml', require('highlight.js/lib/languages/xml'));\n\nconst highlightedCode = hljs.highlight('<span>Hello World!</span>', {language: 'xml'}).value\n```\n\n\n### ES6 Modules / `import`\n\n*Note: You can also import directly from fully static URLs, such as our very own pre-built\nES6 Module CDN resources. See [Fetch via CDN](#fetch-via-cdn) for specific examples.*\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/lib/core';\nimport javascript from 'highlight.js/lib/languages/javascript';\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/styles/github.css';\n```\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=/path/to/highlight 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://github.com/highlightjs/cdn-release/blob/main/DIGESTS.md).\n\n#### cdnjs ([link](https://cdnjs.com/libraries/highlight.js))\n\n##### Common JS <!-- omit in toc -->\n\n```html\n<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.6.0/styles/default.min.css\">\n<script src=\"https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.6.0/highlight.min.js\"></script>\n<!-- and it's easy to individually load additional languages -->\n<script src=\"https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.6.0/languages/go.min.js\"></script>\n```\n\n##### ES6 Modules <!-- omit in toc -->\n\n````html\n<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.6.0/styles/dark.min.css\">\n<script type=\"module\">\nimport hljs from 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.6.0/es/highlight.min.js';\n//  and it's easy to individually load additional languages\nimport go from 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.6.0/es/languages/go.min.js';\nhljs.registerLanguage('go', go);\n</script>\n\n````\n\n\n#### jsdelivr ([link](https://www.jsdelivr.com/package/gh/highlightjs/cdn-release))\n\n##### Common JS <!-- omit in toc -->\n\n```html\n<link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.6.0/build/styles/default.min.css\">\n<script src=\"https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.6.0/build/highlight.min.js\"></script>\n<!-- and it's easy to individually load additional languages -->\n<script src=\"https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.6.0/build/languages/go.min.js\"></script>\n```\n\n##### ES6 Modules <!-- omit in toc -->\n\n```html\n<link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.6.0/build/styles/default.min.css\">\n<script type=\"module\">\nimport hljs from 'https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.6.0/build/es/highlight.min.js';\n//  and it's easy to individually load additional languages\nimport go from 'https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.6.0/build/es/languages/go.min.js';\nhljs.registerLanguage('go', go);\n</script>\n```\n\n#### unpkg ([link](https://unpkg.com/browse/@highlightjs/cdn-assets/))\n\n##### Common JS <!-- omit in toc -->\n\n```html\n<link rel=\"stylesheet\" href=\"https://unpkg.com/@highlightjs/cdn-assets@11.6.0/styles/default.min.css\">\n<script src=\"https://unpkg.com/@highlightjs/cdn-assets@11.6.0/highlight.min.js\"></script>\n<!-- and it's easy to individually load additional languages -->\n<script src=\"https://unpkg.com/@highlightjs/cdn-assets@11.6.0/languages/go.min.js\"></script>\n```\n\n##### ES6 Modules <!-- omit in toc -->\n\n```html\n<link rel=\"stylesheet\" href=\"https://unpkg.com/@highlightjs/cdn-assets@11.6.0/styles/default.min.css\">\n<script type=\"module\">\nimport hljs from 'https://unpkg.com/@highlightjs/cdn-assets@11.6.0/es/highlight.min.js';\n//  and it's easy to individually load & register additional languages\nimport go from 'https://unpkg.com/@highlightjs/cdn-assets@11.6.0/es/languages/go.min.js';\nhljs.registerLanguage('go', go);\n</script>\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://github.com/highlightjs/cdn-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/cdn-assets](https://www.npmjs.com/package/@highlightjs/cdn-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\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/build.js -t node\nnode tools/build.js -t browser :common\nnode tools/build.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 <https://highlightjs.org/>.\n\nFurther in-depth documentation for the API and other topics is at\n<http://highlightjs.readthedocs.io/>.\n\nA list of the Core Team and contributors can be found in the [CONTRIBUTORS.md][8] file.\n\n[1]: http://highlightjs.readthedocs.io/en/latest/api.html#highlightall\n[2]: http://highlightjs.readthedocs.io/en/latest/css-classes-reference.html\n[3]: http://highlightjs.readthedocs.io/en/latest/api.html#highlightelement\n[4]: http://highlightjs.readthedocs.io/en/latest/api.html#configure\n[5]: https://highlightjs.org/download/\n[6]: http://highlightjs.readthedocs.io/en/latest/building-testing.html\n[7]: https://github.com/highlightjs/highlight.js/blob/main/LICENSE\n[8]: https://github.com/highlightjs/highlight.js/blob/main/CONTRIBUTORS.md\n[9]: https://github.com/highlightjs/highlight.js/blob/main/SUPPORTED_LANGUAGES.md\n[10]: https://github.com/highlightjs/\n","readmeFilename":"README.md"}