highlight.js
Reasonable, with limits. 4th of 8 code editors and highlighters.
highlight.js is a zero-dependency syntax highlighter that runs at runtime, covers 190+ languages and can guess a snippet's language. It is reliable and very widely installed, but maintenance has thinned to roughly one active maintainer. For new framework or build-step projects, Shiki now highlights more accurately.
Best for: Pages, CMSs and server code that need simple runtime highlighting with language auto-detection and no build step.
Scores
Overall6.9
How strongly do we recommend it for a new project today?
Claude Opus 5.5: 6.0, likely 5.0 to 7.0
It is a safe, fast and simple choice for runtime highlighting, and the only common one with auto-detection. Thin maintenance holds it back, and for most new framework or build-step projects Shiki gives more accurate output and has the momentum. It ranks below Shiki and around Prism, and it does not compete with the editors in this category.
- highlightjs.org/news: Maintenance was paused and recovered in 2026
- peers Shiki: Faster growth and more framework adoption
- pistack.xyz/posts/2026-08-12-highlightjs-vs-prism-vs-shiki-syntax-highlighting-comparison: Recommended for no-build sites, not for modern framework sites
GPT-6.2 Sol: 7.8, likely 6.7 to 8.7
highlight.js is a strong pick when a page needs to color user-supplied snippets quickly, especially when the language may be missing. Shiki is the stronger choice when a build-time pipeline can supply language labels and matching VS Code coloring matters. Established production use supports confidence in highlight.js today, while the recent publishing gap leaves its future release cadence uncertain.
- github.com/highlightjs/highlight.js/blob/main/docs/api.rst: Direct DOM highlighting and optional language detection.
- chsm.dev/blog/2025/01/08/comparing-web-code-highlighters: Independent comparison shows the speed and coloring trade-off.
- docs.astro.build/en/guides/syntax-highlighting: Astro defaults to Shiki for pre-rendered Markdown code blocks.
- docs.gitlab.com/user/project/repository/files/highlighting: Production use for browser-side repository file viewing.
- github.com/highlightjs/highlight.js/releases/tag/11.11.2: Release notes document the gap and publishing recovery.
Needed by many5.3
How many developers need a tool for this job?
Claude Opus 5.5: 6.0, likely 5.0 to 7.0
Highlighting code is common on docs sites, blogs, chat apps and dev tools, but most web apps do not need it. highlight.js covers only the highlighting half of the category and none of the editing. It works on any runtime and framework, so its audience is not narrowed further.
- dependents: 700k dependent repos show highlighting is a widespread need
- pistack.xyz/posts/2026-08-12-highlightjs-vs-prism-vs-shiki-syntax-highlighting-comparison: Positioned for plain HTML, CMS and Node use
GPT-6.2 Sol: 4.6, likely 3.5 to 5.7
Read-only code highlighting serves documentation, forums, and repository viewers across frameworks. The library covers the display side of the category, while Monaco and CodeMirror also handle editing. The sources show several distinct uses, with little evidence about what share of JavaScript projects need them.
- github.com/highlightjs/highlight.js: Browser and Node.js support with framework-independent setup.
- docs.gitlab.com/user/project/repository/files/highlighting: GitLab uses highlight.js for file viewing and Monaco for editing.
- docs.asciidoctor.org/asciidoctor/latest/syntax-highlighting/highlightjs: Asciidoctor supports client-side highlighting for documentation.
Helps a lot7.3
How well does it do the job for those who need it?
Claude Opus 5.5: 6.5, likely 5.5 to 7.5
It does the job well: it is fast, it auto-detects languages, it covers a broad set of grammars and themes, and it ships types. Its limits are clear. The regex grammars are less exact than Shiki's on complex code, the full bundle is large, and the output is fixed HTML with no token API. Shiki does the same job better for build-time and framework sites.
- dev.to/begin/tale-of-the-tape-highlightjs-vs-shiki-27ce: About 44x faster than Shiki with near-identical output on the test sample; the bundle is larger
- pistack.xyz/posts/2026-08-12-highlightjs-vs-prism-vs-shiki-syntax-highlighting-comparison: Short snippets get misdetected, one theme per page, less accurate than TextMate grammars
- npm hasTypes: Ships TypeScript types
GPT-6.2 Sol: 8.1, likely 7.1 to 9.0
Version 11.12.0 combines broad language coverage, selective imports, and typed APIs with clear examples that are easy for coding agents to follow. An independent comparison found it faster than Shiki and slower than Prism on its sample, with Shiki producing more precise coloring. Language detection is heuristic, and an open TypeScript report illustrates how grammar edge cases can interrupt highlighting. Performance and accuracy still depend on the languages and inputs a project uses.
- github.com/highlightjs/highlight.js/releases/tag/11.12.0: Current stable release includes parser and grammar fixes.
- github.com/highlightjs/highlight.js/blob/main/docs/api.rst: Documented explicit-language, automatic detection, and DOM APIs.
- npm hasTypes: TypeScript declarations ship with the package.
- chsm.dev/blog/2025/01/08/comparing-web-code-highlighters: Firsthand comparison of coloring, bundle size, and speed.
- github.com/highlightjs/highlight.js/issues/4301: Open report of broken coloring after a TypeScript array assertion.
Holds up over time5.9
Will it still be a good choice in two years?
Claude Opus 5.5: 5.0, likely 4.0 to 6.5
Releases resumed in 2026 with 11.11.2 and 11.12.0, there were 139 commits last year, and publishing moved to npm Trusted Publishers. But the project's own news said it had been inactive for about a year. A revoked token broke the release pipeline for months, and one maintainer carries most of the work. The ecosystem's default for new docs tooling is moving towards Shiki.
- highlightjs.org/news: Said it had been inactive since the prior summer, asked for maintainers, and described the broken pipeline
- github releasesLastYear: 2 releases, 139 commits in the last year
- summary.ecosyste.ms/projects/372055: joshgoebel listed as the only active maintainer
GPT-6.2 Sol: 6.7, likely 5.4 to 7.8
The project recorded 139 commits and two releases in the past year, and two core team members handled its latest GitHub releases. Publishing resumed after a year-long gap, and the maintainers are recruiting reviewers while some grammar bugs remain open for a year or more. The v12 milestone has no due date, and long-term funding and release coverage remain unclear.
- github commitsLastYear, releasesLastYear and pushedAt: 139 commits, two releases, and a November push.
- github.com/highlightjs/highlight.js/releases: Two recent release authors and a documented publishing gap.
- github.com/highlightjs/highlight.js/issues/1678: Core team is recruiting reviewers and maintainers.
- github.com/highlightjs/highlight.js/issues/4301: TypeScript grammar report has remained open since August 2025.
- github.com/highlightjs/highlight.js/milestones: Version 12 has open work and no due date.
Used widely8.5
How many use it, and is that growing?
Claude Opus 5.5: 8.5, likely 7.5 to 9.0
It has the most dependents in the category, with 700k repos and 11k packages, far above Prism's 219k. It also has the most downloads, at 213M per 4 weeks. Much of that comes through other packages such as markdown renderers and lowlight. Its growth ratio of 4.45 is only slightly above the 4.1 median, while Shiki grew about 9.7x, so its share of new projects is flat to falling.
- npm downloadsLast4Weeks: 212.7M, up from 47.8M a year before (ratio about 4.45)
- dependents: 700,734 repos and 11,299 packages, the highest among peers
- peers Shiki: Shiki grew about 9.7x over the same period
GPT-6.2 Sol: 8.4, likely 7.3 to 9.4
Ecosyste.ms found about 701,000 dependent repositories and 11,300 packages, with repository counts well ahead of Prism and Shiki. Four-week npm downloads grew 4.45 times year over year, slightly above the 4.1 catalog median and well behind Shiki's 9.70 times. Automated installs and wrappers such as lowlight inflate the download count, while CDN use bypasses npm, so the rate of direct adoption is harder to estimate.
- dependents repos and packages: 700,734 repositories and 11,299 packages in the indexed sample.
- npm downloadsLast4Weeks, downloadsSame4WeeksYearAgo and medianDownloadsRatio: 212.7 million versus 47.8 million downloads, or 4.45 times.
- peers: Leads indexed repository counts; Shiki and Prism grew 9.70 and 3.86 times respectively.
- github.com/wooorm/lowlight: Several downstream integrations install highlight.js through lowlight.
- docs.asciidoctor.org/asciidoctor/latest/syntax-highlighting/highlightjs: Asciidoctor can load highlight.js from a CDN.
Vouched for7.5
Who stands behind it being good?
Claude Opus 5.5: 6.5, likely 5.5 to 7.5
It is long-established and built into many markdown, docs and forum tools, and independent comparisons still recommend it for runtime highlighting. Current endorsements from big frameworks have gone mostly to Shiki, which is the default in Astro, VitePress and others. Hacker News and Bluesky show almost no recent discussion.
- pistack.xyz/posts/2026-08-12-highlightjs-vs-prism-vs-shiki-syntax-highlighting-comparison: Independent 2026 comparison recommends it for no-build setups and prefers Shiki for frameworks
- dev.to/begin/tale-of-the-tape-highlightjs-vs-shiki-27ce: A team chose it for Lambda after benchmarking
- bluesky posts: Only 3 posts, 0 HN stories
GPT-6.2 Sol: 8.4, likely 7.5 to 9.3
GitLab uses highlight.js in its repository file viewer, and Stack Exchange uses it to color code blocks across its sites. Asciidoctor.js ships an adapter, and Tiptap uses it through lowlight. These integrations show where it works in production, while survey evidence on satisfaction and retention is sparse.
- docs.gitlab.com/user/project/repository/files/highlighting: Production client-side repository highlighting.
- meta.stackoverflow.com/tags/syntax-highlighting/info: Stack Exchange documents network-wide use.
- docs.asciidoctor.org/asciidoctor.js/latest/whats-new: Asciidoctor.js ships build-time highlighting through its adapter.
- tiptap.dev/docs/editor/extensions/nodes/code-block-lowlight: Tiptap documents its lowlight integration.
- github.com/wooorm/lowlight: Lowlight uses highlight.js as its engine.
- 2025.stateofjs.com/en-US/other-tools: The surveyed tools provide no highlight.js satisfaction result.
Safe8.0
How safe is it to depend on?
Claude Opus 5.5: 8.0, likely 7.0 to 9.0
It has zero dependencies and a BSD-3-Clause licence. Its only two advisories, a ReDoS and a prototype pollution, date from 2020 and were fixed. Publishing now uses Trusted Publishers. The Scorecard is 6.6, with weak checks for token permissions, pinned dependencies and fuzzing, and the small maintainer team is a residual risk.
- advisories: 2 moderate advisories from 2020, none in the last 24 months
- npm dependencies: 0 dependencies
- scorecard: 6.6 overall; Token-Permissions 0, Pinned-Dependencies 2, Fuzzing 0
- highlightjs.org/news: 11.12.0 moved publishing to Trusted Publishers
GPT-6.2 Sol: 8.0, likely 6.9 to 9.0
Zero runtime dependencies and a permissive BSD-3-Clause license keep dependency risk low. Both known moderate advisories date to 2020 and were fixed before the current release line. npm publishing moved to trusted publishing, and the Scorecard gives high marks for code review and the security policy. Weak workflow token permissions and dependency pinning, plus a zero fuzzing score, leave room for improvement.
- npm dependencies and license: Zero runtime dependencies and BSD-3-Clause.
- advisories total and last24Months: Two historical advisories and none in the past 24 months.
- github.com/highlightjs/highlight.js/security: Lists both advisories and the supported 11.x release line.
- github.com/highlightjs/highlight.js/pull/4427: Merged migration to npm trusted publishing.
- scorecard score and checks: 6.6 overall, with token permissions 0, pinning 2, and fuzzing 0.
Good
- It has no runtime dependencies and needs only a script tag and `hljs.highlightAll()` to start.
- Language auto-detection is built in, which most peers lack.
- It is fast, both in the browser and in Node, and an independent benchmark measured it about 44x faster than Shiki.
- There are 190+ grammars and 100+ themes, and it is a mature, well-known API that AI agents write correctly.
Bad
- Its regex grammars are less accurate than Shiki's TextMate/VS Code grammars on complex modern syntax.
- The full bundle is large (about 280 kB gzipped) unless you import the core and pick languages by hand.
- Maintenance rests mostly on one person, and the project said it had been inactive for about a year before its 2026 releases.
- It only highlights code. It cannot edit code, and it offers no token-level API for custom rendering.
The numbers
- npm downloads, 4 weeks
- 213M ×4.4 in a year
- GitHub stars
- 25k
- Commits, 12 months
- 139
- npm version
- 11.12.0 Aug 2026
- Versions, 12 months
- 2
- Advisories, 24 months
- 0 of 2 ever
- OpenSSF Scorecard
- 6.6 out of 10, Nov 2026
- Licence
- BSD-3-Clause
Read on 21 November 2026 from GitHub (highlightjs/highlight.js), npm (highlight.js), OSV and the OpenSSF Scorecard.