@lezer/highlight

Syntax highlighting framework that maps Lezer parse trees to styleable highlighting tags

Library
npm
v1.2.5
41 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
22 /100 Needs Attention
Development Activity 4
Maintenance 0
Community 16
Maturity 56
Momentum 12

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
75 /100 Good
Architecture 85
Code Quality 78
Innovation 82
Learning Curve 55

@lezer/highlight is the syntax highlighting layer of the Lezer parser system used by CodeMirror. It defines a mostly closed vocabulary of highlighting tags, lets language packages associate tree nodes with those tags, and provides highlighters that turn tagged nodes into CSS classes or inline styles.

Rather than matching raw token strings, it works over structured Lezer parse trees, so highlighting stays consistent across languages and themes. It ships as a tiny, dependency-light TypeScript library that powers highlighting for every CodeMirror 6 language mode.

What You Get

  • A closed, extensible vocabulary of highlighting tags (tags) shared across all Lezer languages
  • styleTags to associate syntax tree node types with highlighting tags in a language grammar
  • tagHighlighter and the ready-made classHighlighter for turning tags into CSS classes
  • highlightTree and highlightCode to walk a parse tree and emit styled ranges or DOM
  • Tag modifiers and inheritance so themes can fall back from specific to general tags

Common Use Cases

  • Adding syntax highlighting to a CodeMirror 6 editor via a language package
  • Authoring a new Lezer language mode that exposes highlighting metadata
  • Rendering static, highlighted code snippets outside an editor with highlightCode
  • Building custom editor themes that map highlighting tags to CSS classes

Under The Hood

Architecture - The entire library lives in a single src/highlight.ts module built around a Tag class whose instances form a specificity-ordered set of parent tags, with Modifier instances lazily generating modified tags and caching them via a power-set of parent configurations. styleTags compiles a selector spec into a Rule linked list stored on nodes through a ruleNodeProp NodeProp; highlightTree and highlightCode then drive a HighlightBuilder that walks the tree with a TreeCursor, resolves the active tags via getStyleTags, and calls a Highlighter to emit class names for each styled range. Tech Stack - Written in TypeScript targeting both ESM and CommonJS (dist/index.js and dist/index.cjs), its only runtime dependency is @lezer/common for tree and NodeProp primitives, and it builds with @marijn/buildtool and TypeScript 5. Code Quality - The code is dense but carefully commented with /// doc comments feeding the generated API reference, uses precise readonly types and internal markers, and favors small pure helpers (sameArray, powerSet); there is no test directory in the repository, so correctness relies on the broader Lezer/CodeMirror integration suite rather than local unit tests. API Design - The public surface is small and composable - tags, styleTags, tagHighlighter/classHighlighter, and highlightTree/highlightCode - with a closed tag vocabulary and inheritance that lets themes cover many languages with minimal boilerplate, though understanding the tag/modifier model takes some reading of the reference docs.

Used by 47 apps in this directory

TypeScript
62%
Other

Flowise

AI Development · Automation · Developer Tools

55,521

Drag-and-drop visual builder for AI agents, RAG pipelines, and multi-agent systems—deploy anywhere in minutes.

View details
75
Repo Health
77
Technical
63
Dependency
Built with
TypeScript 62%
JavaScript 27%
Updated 2 months ago
TypeScript
63%
MIT

Ghost

Blogging · CMS

55,598

Open source headless Node.js CMS for professional publishing, paid memberships, and newsletters with a fully owned audience.

View details
96
Repo Health
85
Technical
64
Dependency
Built with
TypeScript 63%
JavaScript 35%
Updated 2 days ago
Rust
68%
Other

GitButler

AI Development · Developer Tools · Devops

21,841

Git, but better — a modern version control client with stacked branches, parallel workflows, unlimited undo, and first-class support for AI-powered development.

View details
89
Repo Health
84
Technical
66
Dependency
Built with
Rust 68%
TypeScript 20%
Updated yesterday
Go
83%
MIT

Gitea

Developer Tools · Devops · Project Management

58,668

Self-hosted DevOps in a single Go binary — Git hosting, GitHub Actions-compatible CI/CD, and 30+ package registries without any SaaS dependency.

View details
93
Repo Health
79
Technical
64
Dependency
Built with
Go 83%
Updated yesterday
TypeScript
47%
AGPL 3.0

Grafana

Analytics · Monitoring

77,469

The open-source observability platform that unifies metrics, logs, and traces from any data source into dynamic, queryable dashboards.

View details
95
Repo Health
91
Technical
63
Dependency
Built with
TypeScript 47%
Go 47%
Updated yesterday
TypeScript
68%
MIT

Hoppscotch

Developer Tools

80,676

A lightweight, offline-capable API development ecosystem for testing HTTP, GraphQL, WebSocket, MQTT, and SSE endpoints across web, desktop, and CLI.

View details
91
Repo Health
83
Technical
62
Dependency
Built with
TypeScript 68%
Vue 24%
Updated 2 days ago
TypeScript
96%
Other

Infisical

Devops · Security

29,961

The open-source platform for secrets, certificates, privileged access, and AI agent security — all in one self-hostable system.

View details
91
Repo Health
84
Technical
64
Dependency
Built with
TypeScript 96%
Updated yesterday
TypeScript
77%
Other

Joplin

Note Taking

56,853

The privacy-first, open-source note-taking app with end-to-end encrypted sync, AI assistance, and a powerful plugin ecosystem across every platform.

View details
93
Repo Health
87
Technical
60
Dependency
Built with
TypeScript 77%
JavaScript 14%
Updated 2 days ago
TypeScript
63%
Apache 2.0

Laminar

AI Development · Monitoring

3,434

Open-source observability platform purpose-built for AI agents — trace, evaluate, debug, and monitor at scale with SQL access and real-time replay.

View details
86
Repo Health
76
Technical
65
Dependency
Built with
TypeScript 63%
Rust 35%
Updated yesterday

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers