feat: markdown spec parser for generate-spec#3528
Open
Apollon77 wants to merge 8 commits intospec15gen-v2from
Open
feat: markdown spec parser for generate-spec#3528Apollon77 wants to merge 8 commits intospec15gen-v2from
Apollon77 wants to merge 8 commits intospec15gen-v2from
Conversation
The generate-spec tool now auto-detects markdown spec directories (containing _index.md files) and parses them using a new markdown pipeline, while preserving the existing HTML pipeline as fallback. New modules in support/codegen/src/mom/spec/md/: - md-utils.ts: frontmatter parsing, text/prose element helpers - parse-tables.ts: pipe table + HTML table parsing with overflow cell merging for unescaped | in conformance expressions - scan-markdown.ts: document scanner yielding HtmlReference objects - load-markdown-files.ts: directory discovery and file concatenation Also adds scan-spec.ts routing function and extends translate-cluster.ts and translate-global.ts for markdown-specific patterns (command direction <= syntax, status code obsolete name cleanup). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Generated from the markdown version of the Matter 1.5.1 specification. Produces identical validation results (7 errors, 7980 elements) as the HTML source. Text differences are limited to prose formatting: different word wrapping, admonition markers, list formatting, and minor punctuation. No structural or semantic changes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
All changes are in generated JSDoc comments and description strings reflecting the markdown-sourced spec.ts text formatting. No structural or API changes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
More generated JSDoc/description text updates from the markdown-sourced spec.ts. No structural or API changes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
f058ad7 to
7dba748
Compare
lauckhart
reviewed
Apr 3, 2026
Collaborator
lauckhart
left a comment
There was a problem hiding this comment.
What's the goal here? In theory .md parsing could be more lightweight and simplify the pipeline. This seems more like a custom markdown-to-html pass to feed the existing pipeline
Replace MD → HTMLElement → text pipeline with direct MD → text. Drop HTML spec input support entirely. Translators now operate on strings, tables produce string cells at parse time, prose is string[]. Delete scan-document.ts, scan-tables.ts, doc-utils.ts (HTML-only). Rename html-translators.ts → translators.ts with string signatures. Rename HtmlReference → SpecReference across the codebase. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Minor improvements from direct MD → text pipeline: removed spurious heading markers on legend text, better paragraph merging, picked up 8 missing network conditions (Ethernet, WiFi, Thread, etc.). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove references to HTML spec input from README and generate-spec usage text. Fix formatting in generated file. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
generate-spec, auto-detecting format from the--pathdirectory structurespec.tsfrom the Matter 1.5.1 markdown spec with identical validation results (7 errors, 7980 elements)Details
New modules (
support/codegen/src/mom/spec/md/):md-utils.ts— frontmatter parsing, text/prose helpers, heading parserparse-tables.ts— pipe table + HTML table parsing, overflow cell merging for|in conformancescan-markdown.ts— document scanner yieldingHtmlReferenceobjectsload-markdown-files.ts— directory discovery, chapter concatenationKey fixes for markdown compatibility:
client <= serverpattern|overflow: column-aware merging for conformance/constraint expressions<sup>,<a id>, italic/bold markdown stripping in table cells<strong>wrapped namesTest plan
npm run generate-spec -- --path .../markdownproduces 7980 elements, 7 validation errors (matches HTML)npm run generate-spec -- --path .../htmlstill produces identical baseline output (0 diff)npm run generate-modelsucceeds with 6 validation errorsnpm run generate-clusterssucceedsnpm run generate-endpointssucceedsnpm run format-verifycleannpm run testall passing🤖 Generated with Claude Code