lang-html

HTML language support for the CodeMirror code editor, with autocompletion, folding, and nested CSS/JS parsing.

Library
npm
v6.4.12
36stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
26/100Needs Attention
Development Activity12
Maintenance0
Community20
Maturity60
Momentum12

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
86/100Excellent
Architecture85
Code Quality85
Innovation90
Learning Curve70

@codemirror/lang-html is the official HTML language package for CodeMirror 6. It wires the Lezer HTML parser into CodeMirror as an LRLanguage, adding syntax-aware indentation, code folding, bracket matching, and context-aware autocompletion for tags and attributes.

Beyond plain HTML, the package transparently embeds the JavaScript and CSS language packages so that the contents of <script> and <style> blocks (including TypeScript, JSX, and JSON script types) are parsed and highlighted with their own grammars. A single html() call returns a ready-to-use LanguageSupport extension, and options let you register additional nested languages, extra tags, and custom attributes.

What You Get

  • An html() factory that returns a configured CodeMirror LanguageSupport extension in one call
  • Context-aware completion for HTML tags, attributes, and attribute values via htmlCompletionSource
  • Automatic insertion of closing tags as you type > or / through the autoCloseTags extension
  • Nested parsing of JavaScript, TypeScript, JSX, JSON, and CSS inside <script> and <style> tags

Common Use Cases

  • Building an in-browser HTML editor or template editor with rich highlighting and completion
  • Adding an HTML editing mode to a CodeMirror-based IDE, CMS, or documentation tool
  • Editing HTML fragments or email templates with embedded inline CSS and JavaScript

Under The Hood

Architecture The core lives in src/html.ts, which defines an LRLanguage (htmlPlain) built on the @lezer/html parser and augmented with indentNodeProp, foldNodeProp, and bracketMatchingHandle node properties for indentation, folding, and tag matching. The exported htmlLanguage wraps this parser with configureNesting, mixing in nested NestedLang and NestedAttr definitions so <script>/<style> bodies and style/event attributes are parsed by the CSS and JavaScript grammars. The html() function assembles a LanguageSupport from the language plus the autocompletion source, autoCloseTags input handler, and the JavaScript/CSS support extensions, selecting a parser dialect based on matchClosingTags/selfClosingTags config.

Tech Stack Written entirely in TypeScript and published as dual ESM/CJS with type declarations. It depends on the CodeMirror 6 packages (@codemirror/language, @codemirror/state, @codemirror/view, @codemirror/autocomplete, @codemirror/lang-css, @codemirror/lang-javascript) and the Lezer parsers (@lezer/html, @lezer/common, @lezer/css). Building is handled by @codemirror/buildhelper via the cm-buildhelper script.

Code Quality The codebase is small and focused (html.ts plus a large complete.ts tag/attribute spec table) with thorough /// doc comments that also generate the README API reference. Types are precise (TagSpec, NestedLang, NestedAttr) and there is a dedicated test file (test/test-complete.ts) exercising completion behavior via cm-runtests.

API Design The public surface is deliberately minimal and ergonomic: a single html(config) function covers the common case, while htmlCompletionSource, htmlCompletionSourceWith, htmlLanguage, and autoCloseTags are exported for finer control. Configuration options are well-named and documented inline, keeping the required boilerplate to a single extension entry in an editor’s setup.

Used by 36 apps in this directory

Go
72%
GPL 3.0

1Panel

Devops · Hosting Control Panel · Monitoring

36,573

The only open-source VPS control panel with native AI agent runtime — deploy websites, Docker stacks, and local LLMs from one web interface.

View details
91
Repo Health
76
Technical
67
Dependency
Built with
Go72%
Vue28%
Updated today
TypeScript
95%
Apache 2.0

AionUi

AI Agents · Productivity

32,102

Free, open-source Cowork desktop app that unifies Claude Code, Codex, Gemini CLI, and 20+ AI agents into a single platform with multi-agent teams, 24/7 cron automation, and zero-config built-in agent.

View details
88
Repo Health
76
Technical
66
Dependency
Built with
TypeScript95%
Updated today
Python
54%
Other

authentik

Authentication · Security

24,980

The self-hosted Identity Provider that replaces Okta, Auth0, and Entra ID with a unified SSO platform supporting SAML, OAuth2/OIDC, LDAP, RADIUS, and WebAuthn.

View details
92
Repo Health
81
Technical
68
Dependency
Built with
Python54%
TypeScript33%
Updated today
TypeScript
69%
Other

Budibase

Low Code Platforms · No Code Platforms

28,220

Build AI agents, automations, and internal apps on a single open-source platform with full self-hosting control.

View details
92
Repo Health
81
Technical
63
Dependency
Built with
TypeScript69%
Svelte26%
Updated today
TypeScript
99%
Other

byterover-cli

AI Agents · AI Code Assistants

4,941

A portable memory layer for AI coding agents — curate structured project knowledge into a version-controlled context tree that syncs across tools, machines, and teammates.

View details
77
Repo Health
83
Technical
71
Dependency
Built with
TypeScript99%
Updated 1 months ago
TypeScript
92%
MIT

Dittofeed

Marketing · Automation

2,903

Open-source omni-channel customer engagement platform for automating transactional and marketing messages via email, SMS, WhatsApp, Slack, and mobile push.

View details
54
Repo Health
75
Technical
63
Dependency
Built with
TypeScript92%
Updated 4 months ago
Ruby
40%
AGPL 3.0

DocuSeal

Digital Signiture

18,300

Open source document signing platform with WYSIWYG PDF builder, multi-party workflows, REST API, and full self-hosting via Docker.

View details
87
Repo Health
80
Technical
73
Dependency
Built with
Ruby40%
Vue28%
HTML20%
Updated 2 days ago
Java
34%
Apache 2.0

Enso

Analytics · Data Engineering · Low Code Platforms

7,437

A visual and textual programming platform for data prep and analysis where the node graph and the underlying Enso code are always perfectly in sync, built by an Alteryx co-founder on a GraalVM engine.

View details
70
Repo Health
90
Technical
62
Dependency
Built with
Java34%
TypeScript27%
Scala26%
Updated 1 weeks ago
TypeScript
72%
Other

Epicenter

Knowledge Management · Note Taking · Developer Tools

4,761

A local-first monorepo led by Whispering, an open-source speech-to-text app, built on an MIT toolkit that turns your data into plain Markdown and SQLite files you own instead of a database you rent.

View details
88
Repo Health
90
Technical
68
Dependency
Built with
TypeScript72%
Svelte15%
Updated today

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

Search