@codemirror/lang-xml

XML language support package for the CodeMirror 6 code editor

Library
npm
v6.1.0
10stars
MIT License

Repository Health

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

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
74/100Good
Architecture78
Code Quality74
Innovation60
Learning Curve85

@codemirror/lang-xml plugs XML support into the CodeMirror 6 editor: it wires the Lezer XML grammar into CodeMirror’s language framework to provide syntax highlighting and indentation, and layers on editor-specific conveniences like automatic tag closing and schema-aware autocompletion for elements and attributes.

Calling xml() returns a LanguageSupport extension that can be dropped straight into a CodeMirror EditorView’s extensions array. Developers who want intelligent completions (suggesting valid child elements or attribute values as the user types) can optionally pass an ElementSpec/AttrSpec schema describing their XML dialect, which the bundled completeFromSchema helper turns into a CompletionSource.

What You Get

  • The xml() function returning a LanguageSupport extension ready to drop into a CodeMirror EditorView
  • xmlLanguage, a language provider based on the Lezer XML parser with highlighting and indentation baked in
  • autoCloseTags, an extension that inserts closing tags automatically when > or / is typed
  • completeFromSchema(elements, attributes) to build schema-aware completions for elements and attribute values
  • ElementSpec/AttrSpec types for describing an XML dialect’s allowed elements, children, and attributes

Common Use Cases

  • Adding XML editing support (highlighting, indentation, auto-close tags) to a CodeMirror-based web code editor
  • Building a schema-aware XML editor that autocompletes valid child elements and attribute values for a known dialect
  • Embedding an XML/XHTML/config-file editing experience inside a documentation or admin tool built on CodeMirror 6
  • Providing structured editing for XML-based formats (SVG, RSS, custom config schemas) in a browser-based tool

Under The Hood

Architecture - The package is small and cleanly split in two: src/xml.ts (113 lines) defines the xml() entry point, wiring the Lezer-XML-based xmlLanguage together with the autoCloseTags view extension and, when a schema is supplied, a completion source; src/complete.ts (241 lines) implements completeFromSchema, which walks the current syntax tree position to determine valid completions (element names, attribute names, attribute values) based on the caller-supplied ElementSpec/AttrSpec schema. All actual XML parsing is delegated to the separate @lezer/xml grammar package, keeping this package focused purely on editor integration (highlighting, indentation, completion) rather than parsing. Tech Stack - TypeScript, built with the shared @codemirror/buildhelper tooling used across all official CodeMirror 6 language packages. Runtime dependencies are the core CodeMirror 6 modules (@codemirror/autocomplete, @codemirror/language, @codemirror/state, @codemirror/view) plus @lezer/common and @lezer/xml, reflecting its role as a thin adapter layer over the shared CodeMirror/Lezer ecosystem rather than a standalone implementation. Code Quality - test/test-complete.ts specifically exercises the schema-driven completion logic, the most algorithmically interesting part of the package; the parsing and highlighting behavior is implicitly covered by the shared Lezer XML grammar’s own tests. The package has a single primary contributor (Marijn Haverbeke, the CodeMirror/Lezer author), consistent with it being one of many small, focused @codemirror/lang-* packages maintained as part of that ecosystem rather than independently. API Design - The public surface is intentionally minimal: one factory function (xml(conf?)) covers the common case with zero configuration, while power users opt into schema-aware completions by passing typed elements/attributes config objects. This mirrors the consistent, predictable API shape shared across every official @codemirror/lang-* package, so switching between supported languages requires no relearning.

Used by 10 apps in this directory

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
Rust
69%
Other

GitButler

Developer Tools · Devops · AI Development

21,531

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
68
Dependency
Built with
Rust69%
TypeScript18%
Svelte12%
Updated today
TypeScript
67%
MIT

Hoppscotch

Developer Tools

80,055

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
66
Dependency
Built with
TypeScript67%
Vue23%
Updated 3 days ago
TypeScript
100%
Apache 2.0

ILLA Builder

Developer Tools · Low Code Platforms · No Code Platforms

12,311

Open-source low-code platform for building internal tools with drag-and-drop UI, reactive data bindings, and real-time collaboration.

View details
58
Repo Health
71
Technical
65
Dependency
Built with
TypeScript100%
Updated 2 months ago
Python
51%
AGPL 3.0

LearnHouse

Learning Management · CMS

2,178

Open-source LMS with AI tutoring, real-time collaboration boards, live code execution, and built-in course monetization — self-hosted in minutes.

View details
89
Repo Health
77
Technical
67
Dependency
Built with
Python51%
TypeScript48%
Updated 3 days ago
Go
66%
MIT

nginx ignition

Developer Tools · Devops

2,134

A modern web UI for nginx that eliminates config file editing with visual virtual hosts, SSL automation, Docker integrations, and real-time traffic analytics.

View details
71
Repo Health
80
Technical
75
Dependency
Built with
Go66%
TypeScript31%
Updated 4 days ago
Python
74%
AGPL 3.0

OpenViking

Databases · AI Development

29,711

An open-source context database that gives AI agents a unified filesystem for memory, resources, and skills with hierarchical tiered retrieval.

View details
84
Repo Health
75
Technical
65
Dependency
Built with
Python74%
Rust14%
Updated today
TypeScript
60%
MIT

Scalar

Developer Tools

15,944

Beautiful, interactive OpenAPI documentation with a built-in offline-first API client and multi-language code generation — all in one open-source platform.

View details
90
Repo Health
89
Technical
66
Dependency
Built with
TypeScript60%
Vue35%
Updated yesterday
TypeScript
98%
Other

Sourcebot

Search · Developer Tools · AI Code Assistants

3,892

A self-hosted, AI-powered code search engine that indexes every repo across GitHub, GitLab, Bitbucket, Gitea, Gerrit, and Azure DevOps, so both engineers and coding agents can search, browse, and ask questions about your codebase from one place.

View details
86
Repo Health
83
Technical
67
Dependency
Built with
TypeScript98%
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