{"id":14243096,"url":"https://github.com/speed-highlight/core","last_synced_at":"2026-05-07T19:21:23.996Z","repository":{"id":43676492,"uuid":"396000085","full_name":"speed-highlight/core","owner":"speed-highlight","description":"A lightweight syntax highlighter written in JavaScript","archived":false,"fork":false,"pushed_at":"2025-06-03T17:11:19.000Z","size":2416,"stargazers_count":349,"open_issues_count":9,"forks_count":19,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-10-03T14:41:06.899Z","etag":null,"topics":["deno","fast","highlighter","highlighting","highlightjs","javascript","js","language","lightweight","regex","simple","small","syntax-highlighting","ts"],"latest_commit_sha":null,"homepage":"https://speed-highlight.github.io/core/examples/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/speed-highlight.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-08-14T12:18:55.000Z","updated_at":"2025-10-02T00:53:14.000Z","dependencies_parsed_at":"2024-01-25T05:30:17.112Z","dependency_job_id":"d5209e70-b567-4a5c-b6a7-c78614da2ab0","html_url":"https://github.com/speed-highlight/core","commit_stats":{"total_commits":396,"total_committers":17,"mean_commits":"23.294117647058822","dds":0.4747474747474747,"last_synced_commit":"11aeddf0622f3a2f7bb5093748504dfcdb62d1df"},"previous_names":["matubu/speed_highlight_js"],"tags_count":27,"template":false,"template_full_name":null,"purl":"pkg:github/speed-highlight/core","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/speed-highlight%2Fcore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/speed-highlight%2Fcore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/speed-highlight%2Fcore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/speed-highlight%2Fcore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/speed-highlight","download_url":"https://codeload.github.com/speed-highlight/core/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/speed-highlight%2Fcore/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279274130,"owners_count":26138395,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-17T02:00:07.504Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deno","fast","highlighter","highlighting","highlightjs","javascript","js","language","lightweight","regex","simple","small","syntax-highlighting","ts"],"created_at":"2024-08-21T13:01:02.803Z","updated_at":"2025-10-17T02:45:05.573Z","avatar_url":"https://github.com/speed-highlight.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# Speed Highlight JS\n\n\u003cp align=\"center\"\u003e\n\t\u003ca href=\"https://speed-highlight.github.io/core/examples\"\u003eDemo\u003c/a\u003e |\n\t\u003ca href=\"https://github.com/speed-highlight/core/wiki\"\u003eWiki\u003c/a\u003e |\n\t\u003ca href=\"https://speed-highlight.github.io/core/docs\"\u003eDocs\u003c/a\u003e\n\u003c/p\u003e\n\n![Screenshot](https://raw.githubusercontent.com/speed-highlight/core/main/assets/screenshot.png)\n\n- 🪶 Lightweight (**~2kB** for the core + **~1kB** by language)\n- ⚡ Fast (faster than prism and highlight.js on average)\n- 🧹 Minimal Codebase\n\n## Simple setup 🚀\n\n### Web\n\nStyle/theme (in the header of your html file):\n\n```html\n\u003clink rel=\"stylesheet\" href=\"/path/dist/themes/default.css\"\u003e\n```\n\nIn the body of your html file:\n\n```html\n\u003cdiv class='shj-lang-[code-language]'\u003e[code]\u003c/div\u003e\nor\n\u003ccode class='shj-lang-[code-language]'\u003e[inline code]\u003c/code\u003e\n```\n\nHighlight the code (in your javascript):\n\n```js\nimport { highlightAll } from '/path/dist/index.js';\nhighlightAll();\n```\n\nAuto language detection\n\n```js\nimport { highlightElement } from '../dist/index.js';\nimport { detectLanguage } from '../dist/detect.js';\n\nelm.textContent = code;\nhighlightElement(elm, detectLanguage(code));\n```\n\nLoad custom language\n\n```js\nimport { loadLanguage } from '../dist/index.js';\n\nloadLanguage('language-name', customLanguage);\n```\n\n---\n\n#### CDN\n\n```html\n\u003clink rel=\"stylesheet\" href=\"https://unpkg.com/@speed-highlight/core/dist/themes/default.css\"\u003e\n\u003clink rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/gh/speed-highlight/core/dist/themes/default.css\"\u003e\n```\n\n```js\nimport ... from 'https://unpkg.com/@speed-highlight/core/dist/index.js';\nimport ... from 'https://cdn.jsdelivr.net/gh/speed-highlight/core/dist/index.js';\n```\n\n---\n\n### Deno\n\nUse the [deno module](https://deno.land/x/speed_highlight_js)\n\n```js\nimport { setTheme, printHighlight } from 'https://deno.land/x/speed_highlight_js/dist/terminal.js';\n\nawait setTheme('[theme-name]');\nprintHighlight('console.log(\"hello\")', 'js');\n```\n\n---\n\n### Node\n\nUse the [npm package](https://www.npmjs.com/package/@speed-highlight/core)\n\n```bash\nnpm i @speed-highlight/core\n```\n\n```js\nconst { setTheme, printHighlight } = require('@speed-highlight/core/terminal');\n\nsetTheme('[theme-name]');\nprintHighlight('console.log(\"hello\")', 'js');\n```\n\n## Migrating from prism\n\nSpeed-highlight JS is a lighter and faster version of prism that share a similar API\n\n### Style\n\nRemove the prism stylesheet in the head of your html file\nClone this repository or use a cdn to load our stylesheet\n\n```diff\n\u003chead\u003e\n-  \u003clink href=\"themes/prism.css\" rel=\"stylesheet\" /\u003e\n+  \u003clink rel=\"stylesheet\" href=\"https://unpkg.com/@speed-highlight/core/dist/themes/default.css\"\u003e\n\u003c/head\u003e\n```\n\n### Script\n\nFor the script part remove the prism.js script and replace it by a import and a call to `highlightAll`\n\n```diff\n\u003cbody\u003e\n-  \u003cscript src=\"prism.js\"\u003e\u003c/script\u003e\n+\u003cscript\u003e\n+  import { highlightAll } from 'https://unpkg.com/@speed-highlight/core/dist/index.js';\n+  highlightAll();\n+\u003c/script\u003e\n\u003c/body\u003e\n```\n\nIf you want to highlight only a specific element you can use the `highlightElement` function instead\n\n### Code block\n\nFor the code blocks replace the `\u003cpre\u003e\u003ccode\u003e` by only one `\u003cdiv\u003e`\nAnd use `shj-lang-` prefix instead of `language-` for the class property\n\n```diff\n-\u003cpre\u003e\u003ccode class=\"language-css\"\u003ep { color: red }\u003c/code\u003e\u003c/pre\u003e\n+\u003cdiv class=\"shj-lang-css\"\u003ep { color: red }\u003c/div\u003e\n```\n\nAnd for inline code block you just have to change the class property\n\n```diff\n-\u003ccode class=\"language-css\"\u003ep { color: red }\u003c/code\u003e\n+\u003ccode class=\"shj-lang-css\"\u003ep { color: red }\u003c/code\u003e\n```\n\n## Languages supported 🌐\n\n| Name       | Class name          | Support                                             | Language detection |\n| ---------- | ------------------- | --------------------------------------------------- | ------------------ |\n| asm        | shj-lang-asm        |                                                     | ✅                 |\n| bash       | shj-lang-bash       |                                                     | ✅                 |\n| brainfuck  | shj-lang-bf         | increment, operator, print, comment                 | ❌                 |\n| c          | shj-lang-c          |                                                     | ✅                 |\n| css        | shj-lang-css        | comment, str, selector, units, function, ...        | ✅                 |\n| csv        | shj-lang-csv        | punctuation, ...                                    | ❌                 |\n| diff       | shj-lang-diff       |                                                     | ✅                 |\n| docker     | shj-lang-docker     |                                                     | ✅                 |\n| git        | shj-lang-git        | comment, insert, deleted, string, ...               | ❌                 |\n| go         | shj-lang-go         |                                                     | ✅                 |\n| html       | shj-lang-html       |                                                     | ✅                 |\n| http       | shj-lang-http       | keywork, string, punctuation, variable, version     | ✅                 |\n| ini        | shj-lang-ini        |                                                     | ❌                 |\n| java       | shj-lang-java       |                                                     | ✅                 |\n| javascipt  | shj-lang-js         | basic syntax, regex, jsdoc, json, template literals | ✅                 |\n| jsdoc      | shj-lang-jsdoc      |                                                     | ❌                 |\n| json       | shj-lang-json       | string, number, bool, ...                           | ❌                 |\n| leanpub-md | shj-lang-leanpub-md |                                                     | ❌                 |\n| log        | shj-lang-log        | number, string, comment, errors                     | ❌                 |\n| lua        | shj-lang-lua        |                                                     | ✅                 |\n| makefile   | shj-lang-make       |                                                     | ✅                 |\n| markdown   | shj-lang-md         |                                                     | ✅                 |\n| perl       | shj-lang-pl         |                                                     | ✅                 |\n| plain      | shj-lang-plain      |                                                     | ❌                 |\n| python     | shj-lang-py         |                                                     | ✅                 |\n| regex      | shj-lang-regex      | count, set, ...                                     | ❌                 |\n| rust       | shj-lang-rs         |                                                     | ✅                 |\n| sql        | shj-lang-sql        | number, string, function, ...                       | ✅                 |\n| todo       | shj-lang-todo       |                                                     | ❌                 |\n| toml       | shj-lang-toml       | comment, table, string, bool, variable              | ❌                 |\n| typescript | shj-lang-ts         | js syntax, ts keyword, types                        | ✅                 |\n| uri        | shj-lang-uri        |                                                     | ✅                 |\n| xml        | shj-lang-xml        |                                                     | ✅                 |\n| yaml       | shj-lang-yaml       | comment, numbers, variable, string, bool            | ❌                 |\n\n## Themes 🌈\n\nA modern theme by default\n\n| Name                | Terminal | Web |\n| ------------------- | -------- | --- |\n| default             | ✅       | ✅  |\n| github-dark         | ❌       | ✅  |\n| github-light        | ❌       | ✅  |\n| github-dim          | ❌       | ✅  |\n| atom-dark           | ✅       | ✅  |\n| visual-studio-dark  | ❌       | ✅  |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspeed-highlight%2Fcore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspeed-highlight%2Fcore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspeed-highlight%2Fcore/lists"}