lang-markdown

Markdown language support for the CodeMirror 6 code editor

Library
npm
v6.5.2
131 stars
MIT License

Repository Health

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

Technical Analysis

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

@codemirror/lang-markdown is the official Markdown language package for CodeMirror 6. It wires the Lezer Markdown parser into CodeMirror’s language system, giving an editor CommonMark and GitHub Flavored Markdown parsing, syntax highlighting, section folding, and Markdown-aware editing commands.

Beyond parsing, the package layers in editor ergonomics: fenced code blocks can be highlighted with nested language parsers, HTML tags are completed as you type, pasted URLs become links over a selection, and Enter/Backspace continue or unwind list and blockquote markup. It ships as a small, tree-shakeable ES module with TypeScript types.

What You Get

  • A markdown() extension factory returning a CodeMirror LanguageSupport value
  • commonmarkLanguage and markdownLanguage (GFM plus subscript, superscript, and emoji) as ready-made Language values
  • Nested parsing of fenced code blocks via configurable code languages
  • Markdown editing commands and a keymap for continuing lists and blockquotes
  • HTML-tag autocompletion and a paste-URL-as-link extension

Common Use Cases

  • Adding a Markdown editing mode to a CodeMirror-based text or code editor
  • Building a documentation or note-taking app with live Markdown syntax highlighting
  • Highlighting fenced code blocks inside Markdown using other CodeMirror language packages
  • Providing GFM support (tables, task lists, strikethrough) in an embedded editor

Under The Hood

Architecture - The package is a thin, well-factored adapter over the Lezer Markdown parser. markdown.ts configures the base Lezer parser with CodeMirror NodeProps for folding, heading levels, indentation, and language data, then wraps it in a Language via mkLang, exporting commonmarkLanguage and an extended GFM+subscript/superscript/emoji markdownLanguage. index.ts exposes the public markdown() factory that assembles a LanguageSupport, pulling in HTML tag handling, parseCode for nested fenced-code parsing through getCodeParser, an optional keymap, HTML-tag autocompletion, and the pasteURLAsLink DOM handler; commands.ts implements the list/blockquote continuation and deletion commands.

Tech Stack - Written in TypeScript targeting an ES module (type: module, dual import/require exports) with sideEffects: false for tree-shaking. It depends on the CodeMirror 6 core (@codemirror/state, @codemirror/view, @codemirror/language, @codemirror/autocomplete), @codemirror/lang-html for embedded HTML, and @lezer/markdown/@lezer/common for parsing. Build and test tooling comes from @codemirror/buildhelper (cm-buildhelper, cm-runtests).

Code Quality - The code is idiomatic and tightly scoped across four small source files, using triple-slash doc comments on the public API that double as generated README reference docs. A test/test-commands.ts suite exercises the Markdown editing commands. Naming is consistent with the wider CodeMirror ecosystem, types are precise, and edge cases (non-plain-text nodes, tight vs. non-tight lists, code/comment regions) are handled explicitly.

API Design - The developer experience is excellent: a single markdown(config?) call returns a ready extension, and the config object is small but expressive (codeLanguages, defaultCodeLanguage, addKeymap, base, completeHTMLTags, pasteURLAsLink, htmlTagLanguage). Sensible defaults mean zero-config usage works, while advanced needs like nested language highlighting are a one-line addition. The public surface is documented inline and mirrored in the README API reference.

Used by 33 apps in this directory

Go
62%
Apache 2.0

Harness Open Source

Code Editors · Developer Tools · Devops

38,684

A unified open source DevOps platform combining Git hosting, CI/CD pipelines, cloud development environments, and artifact registries in a single self-hosted system.

View details
90
Repo Health
79
Technical
64
Dependency
Built with
Go 62%
TypeScript 33%
Updated 1 weeks ago
TypeScript
91%
Apache 2.0

HyperFrames

AI Design Tools · AI Development

70,938

Turn plain HTML and CSS into deterministic, pixel-perfect MP4 videos — authored by humans or AI agents, rendered by headless Chrome and FFmpeg.

View details
84
Repo Health
83
Technical
65
Dependency
Built with
TypeScript 91%
Updated 6 days ago
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 1 weeks ago
TypeScript
52%

Kener

Devops · Monitoring

5,216

Stunning, self-hosted status pages with real-time uptime monitoring, incident management, and multi-channel notifications in a single Docker container.

View details
87
Repo Health
76
Technical
66
Dependency
Built with
TypeScript 52%
Svelte 45%
Updated 1 weeks ago
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
Go
51%
AGPL 3.0

listmonk

Blogging · Marketing

23,944

High-performance, self-hosted newsletter and mailing list manager packaged as a single binary with built-in analytics, transactional messaging, and multi-channel delivery.

View details
90
Repo Health
74
Technical
64
Dependency
Built with
Go 51%
JavaScript 22%
HTML 20%
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

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