Overview of @lezer/markdown
main@lezer/markdown is an incremental Markdown parser that supports CommonMark and various extensions. It is designed to integrate with the Lezer parser system by producing Lezer-style compact syntax trees and consuming fragments of such trees for incremental parsing.
Key Characteristics:
- Incremental Parsing: It is designed for performance by only re-parsing changed parts of a document.
- Syntax Tree Focus: It produces a data structure representing the syntactic form of the document. It does not handle HTML output.
- Parsing Limitations: To maintain single-pass incremental performance, it does not perform certain CommonMark validations, such as validating link references (e.g.,
[a][b]will be parsed as a link even if the reference[b]is missing). - CodeMirror Integration: For editor support, use the @codemirror/lang-markdown package, which integrates this parser into the CodeMirror editor.