Markdown Conformance
Lanexio™ Parser’s Markdown parser passes all 652 CommonMark 0.31.2 examples and all 648 GFM examples.
Curated CommonMark gate (CI)
Section titled “Curated CommonMark gate (CI)”CommonMark 0.31.2 is continuously validated in CI through two surfaces:
- Package harness (
pnpm test:packages): every one of the 652 spec examples has its ownit()block, rendered throughrenderMarkdownHtmland compared byte-for-byte to the spec HTML, honoring the package ledger (packages/parser-grammar-markdown/src/spec/expectations.json). - Repo-level aggregate (
pnpm test:curated-suites, see ADR 0034): one aggregate assertion runs the same oracle over all 652 examples so a singlepnpm test:repo-gatevalidates toml-test, xmlts, and CommonMark together. Any example whose outcome contradicts the ledger fails the aggregate.
The ledger currently carries 0 expect-fail and 0 skip entries: 652/652 pass.
Serializer roundtrip
Section titled “Serializer roundtrip”The Markdown serializer (serializeMarkdown) was delivered in phases MD-S1 through
MD-S4. All CommonMark and GFM features roundtrip correctly: parse → serialize →
re-parse produces AST-identical trees.
| Phase | Features | Tests |
|---|---|---|
| MD-S1 | Leaf blocks (thematic breaks, code blocks, HTML) | 1,841 |
| MD-S2 | Headings, paragraphs, inline formatting | 1,864 |
| MD-S3 | Links, images, blockquotes, lists | 1,880 |
| MD-S4 | GFM tables, character escaping, golden roundtrip | 1,898 |
Test suite results
Section titled “Test suite results”| Suite | Tests | Passed | Failed |
|---|---|---|---|
| CommonMark 0.31.2 | 652 | 652 | 0 |
| GitHub Flavored Markdown | 648 | 648 | 0 |
| Total | 1,300 | 1,300 | 0 |
The docs/MARKDOWN_GAPS.md ledger in the repository is a frozen Phase 1 pre-flight triage (snapshot 2026-05-01) that predates the completed CommonMark and GFM work; it does not reflect current results.
CommonMark spec coverage
Section titled “CommonMark spec coverage”All 652 CommonMark 0.31.2 spec examples pass. Covered sections include:
| Section | Examples |
|---|---|
| Thematic breaks | 19 |
| ATX headings | 16 |
| Setext headings | 26 |
| Indented code blocks | 12 |
| Fenced code blocks | 29 |
| HTML blocks | 44 |
| Link reference definitions | 27 |
| Paragraphs | 8 |
| Block quotes | 25 |
| List items | 48 |
| Lists | 26 |
| Backslash escapes | 13 |
| Entity references | 12 |
| Code spans | 17 |
| Emphasis and strong emphasis | 131 |
| Links | 68 |
| Images | 22 |
| Autolinks | 19 |
| Raw HTML | 21 |
| Hard line breaks | 15 |
| Soft line breaks | 2 |
| Textual content | 1 |
GFM spec coverage
Section titled “GFM spec coverage”All 648 GFM-specific examples pass. GFM extensions covered:
| Extension | Status |
|---|---|
| Tables | Implemented |
| Task list items | Implemented |
| Strikethrough | Implemented |
| Autolinks (extended) | Implemented |
| Disallowed raw HTML | Implemented |
GFM is default
Section titled “GFM is default”GFM extensions are enabled by default in parseMarkdown. Pass { gfm: false } for strict CommonMark-only parsing.
Large-file performance
Section titled “Large-file performance”The Markdown grammar is linear-time on large inputs. Four quadratic pathologies were mitigated in a single performance run, all behavior-identical:
- Extended-autolink email fallback: the inline loop skips the email
fallback entirely when the inline text has no
@, and resolves the residual with-@case through a once-per-inline-textnextAttable plus adeadAtmemo (amortized O(1) per boundary). - Multi-line paragraph byte offsets: the per-lookup segment-slice scan
is replaced by a precomputed
byteAttable plus abreakByteOverridesmap (one O(n) build, 4 bytes per char, multi-line paragraphs only). - Document gap fill:
fillDocumentGapsbuilds the node array in a single forward pass instead of splicing O(gaps x n). - Container close:
closeContainersTorescans only the fresh region between a container and the previously closed inner container, carrying the inner max end forward.
The regression guard
packages/parser-grammar-markdown/src/large-file-robustness.test.ts runs
four adversarial fixtures (one per pathology) asserting a < 2000 ms 1x
parse, a < 3.5 2x/1x scaling ratio, emitSource byte round-trip, and no
parse errors.
Spec references
Section titled “Spec references”CommonMark 0.31.2 specification
RAG: commonmark_docs::spec@0.31.2
GitHub Flavored Markdown specification
RAG: gfm_docs::spec@gfm-0.29.0
Corpus conformance
Section titled “Corpus conformance”pnpm conformance:suite measured this family over the test_files/md corpus on 2026-10-06
at Lanexio™ Parser version 1.0.0:
| family | valid | invalid | raw | contract-subset | REAL-DEFECT |
|---|---|---|---|---|---|
| markdown | 10800 | 8 | 99.9% | 100.0% (10800/10800) | 0 |
The raw figure is below 100.0% because the directory rule classifies 8 inputs as invalid; the contract-subset over the 10,800 valid inputs is 100.0%.