@codemirror/legacy-modes

A collection of over 100 ported legacy stream-parser language modes for CodeMirror 6

Library
npm
v6.5.5
107 stars
MIT License

Repository Health

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

Technical Analysis

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

@codemirror/legacy-modes packages up the older, stream-based language modes originally written for CodeMirror 5 so they can be used with CodeMirror 6’s newer, more structured language system. Each mode is shipped as its own file under mode/<name>.js and exports a StreamParser that plugs into @codemirror/language’s StreamLanguage.define(), giving CodeMirror 6 editors syntax highlighting for languages that don’t yet have a dedicated Lezer grammar.

Because CodeMirror 6’s core distribution only ships first-class Lezer-based grammars for a handful of mainstream languages, this package fills the long tail: everything from APL and COBOL to Lua, Toml, and dozens of other syntaxes are available as drop-in stream parsers with no separate installation beyond this one package.

What You Get

  • Over 100 individual language mode files, each importable independently as @codemirror/legacy-modes/mode/<name>
  • Each mode exported as a StreamParser compatible with @codemirror/language’s StreamLanguage.define()
  • Coverage of legacy and niche languages (APL, COBOL, ASN.1, Asterisk dialplan, and many more) with no dedicated Lezer grammar in CodeMirror 6 core
  • Both ESM and CommonJS builds via dual import/require export conditions
  • TypeScript type declarations (.d.ts) shipped alongside every mode

Common Use Cases

  • Adding syntax highlighting to a CodeMirror 6 editor for a language that only has a CodeMirror 5-era mode, not a modern Lezer grammar
  • Building general-purpose code editors or admin tools that need broad, long-tail language coverage rather than a curated few languages
  • Migrating a CodeMirror 5 integration to CodeMirror 6 while preserving highlighting for less common languages already relied upon
  • Embedding config-file or infrastructure-as-code editors (e.g. for formats like TOML, Dockerfile, or Nginx config) where a Lezer grammar doesn’t yet exist

Under The Hood

Architecture: The package has no shared runtime logic of its own beyond a thin per-mode wrapper — each mode/<name>.js file defines a CodeMirror 5-style stream parser (a state machine with a token() function reading one token at a time from a StringStream) and exposes it as a StreamParser object matching the shape @codemirror/language’s StreamLanguage.define() expects. There’s deliberately no central registry or barrel export; consumers import exactly the modes they need (@codemirror/legacy-modes/mode/lua), keeping bundle size proportional to usage. Tech Stack: Plain JavaScript (ESM, type: module) built with Rollup into dual ESM/CJS outputs, TypeScript used only for authoring .d.ts declaration files, with @codemirror/language as the sole runtime dependency providing the StreamParser interface being implemented. Code Quality: Tests run through cm-runtests, a shared CodeMirror test runner rather than an in-repo suite, so correctness is validated against upstream CodeMirror project conventions; individual mode files vary in sophistication (some are compact regex-driven tokenizers, others like clike.js implement more elaborate configurable state machines shared across several C-family languages) but follow a consistent token-function convention throughout, a legacy of their shared CodeMirror 5 origin. API Design: The per-language, per-file export convention is the package’s defining ergonomic choice — there is exactly one way to consume any given mode (import {lua} from "@codemirror/legacy-modes/mode/lua" then StreamLanguage.define(lua)), which keeps the API surface predictable across all 100+ modes at the cost of needing to know the exact file/export name for each language in advance.

Used by 23 apps in this directory

Python
53%
AGPL 3.0

LearnHouse

CMS · Learning Management

2,413

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

View details
90
Repo Health
77
Technical
65
Dependency
Built with
Python 53%
TypeScript 45%
Updated 6 days ago
Python
62%
Apache 2.0

marimo

Data Engineering · Developer Tools

23,309

A reactive Python notebook that eliminates hidden state, runs reproducibly, and deploys as a web app or script — stored as pure Python, built for the AI era.

View details
90
Repo Health
91
Technical
65
Dependency
Built with
Python 62%
TypeScript 37%
Updated 6 days ago
TypeScript
81%
AGPL 3.0

massCode

Code Editors · Developer Tools · Productivity

7,085

A free, local-first developer workspace unifying snippets, notes, HTTP requests, calculations, drawings, and dev tools in one desktop app.

View details
85
Repo Health
87
Technical
62
Dependency
Built with
TypeScript 81%
Vue 17%
Updated 2 weeks ago
TypeScript
99%
Apache 2.0

Mastra Code

AI Code Assistants

29,041

"A coding agent that never compacts" — a terminal-based AI coding agent built on the Mastra framework, with Observational Memory instead of context compaction, multi-model support, and OAuth login for Claude Max or ChatGPT Plus.

View details
90
Repo Health
73
Technical
65
Dependency
Built with
TypeScript 99%
Updated 6 days ago
Clojure
57%
Other

Metabase

Analytics

49,827

The open-source BI platform that lets anyone ask questions and build dashboards without writing SQL — with an embedded analytics SDK and AI-powered query assistant included.

View details
95
Repo Health
84
Technical
62
Dependency
Built with
Clojure 57%
TypeScript 38%
Updated 6 days ago
Go
67%
MIT

nginx ignition

Developer Tools · Devops

2,141

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
74
Repo Health
80
Technical
67
Dependency
Built with
Go 67%
TypeScript 28%
Updated 2 weeks ago
TypeScript
99%
Other

NocoBase

Low Code Platforms · No Code Platforms

24,686

Open-source AI + no-code platform that lets coding agents and people collaborate to build business systems fast on proven infrastructure.

View details
94
Repo Health
81
Technical
63
Dependency
Built with
TypeScript 99%
Updated 6 days ago
TypeScript
97%
GPL 3.0

OpenKnowledge

Code Editors · Knowledge Management · Note Taking

4,674

A beautiful, local-first markdown IDE that turns any git repo into a live collaborative workspace for humans and AI coding agents like Claude, Codex, and OpenCode.

View details
80
Repo Health
89
Technical
64
Dependency
Built with
TypeScript 97%
Updated 6 days ago
TypeScript
98%
AGPL 3.0

paseo

AI Agents · AI Code Assistants

21,830

One unified interface to orchestrate Claude Code, Codex, Copilot, OpenCode, and Pi agents in parallel from desktop, mobile, or the terminal.

View details
88
Repo Health
83
Technical
66
Dependency
Built with
TypeScript 98%
Updated 6 days ago

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