Plan: Add MDS034 markdown-flavor validation rule - #127
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #127 +/- ##
=======================================
Coverage 86.16% 86.16%
=======================================
Files 92 92
Lines 9868 9868
=======================================
Hits 8503 8503
Misses 891 891
Partials 474 474 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
Adds plan #86 describing the design for a new opt-in rule (MDS034) to validate Markdown files against a declared Markdown flavor, and updates the plans index to include the new plan.
Changes:
- Added
plan/86_markdown-flavor-validation.mdwith a detailed design/spec for MDS034 (flavor registry, dual-parser approach, detectors, auto-fix strategy, tasks, acceptance criteria). - Updated
PLAN.mdgenerated catalog output to include plan 86.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| plan/86_markdown-flavor-validation.md | New design plan/spec for MDS034 markdown flavor validation rule. |
| PLAN.md | Adds plan 86 to the generated plans catalog table. |
New rule MDS034 that validates Markdown files against a declared flavor (CommonMark, GFM, Goldmark) and reports unsupported syntax with auto-fix where possible. https://claude.ai/code/session_01NXoimZjyg4zz55zx1YXi7W
Evaluated three detection approaches (enable extensions in main parser, regex-only, dual parser). Chose dual parser: MDS034 creates a second goldmark parser with all built-in extensions enabled, giving precise AST detection for 7 of 11 features without affecting existing rules. Regex fallback only for math, abbreviations, superscript, subscript. https://claude.ai/code/session_01NXoimZjyg4zz55zx1YXi7W
subscript, math-block Evaluated custom extensions vs regex vs third-party deps for the 4 features without built-in goldmark support. Third-party extensions are abandoned or unsuitable. Custom inline/block parsers cost ~200 LOC each and give precise AST detection. Regex kept only for math-inline ($ too ambiguous) and abbreviations (too rare to justify ~400 LOC extension). https://claude.ai/code/session_01NXoimZjyg4zz55zx1YXi7W
Regex cannot reliably distinguish $x+y$ (math) from costs $5 (currency) or $PATH (env var) without delimiter-state tracking. Added MathInlineExt with Pandoc-style flanking rules. Now 4 custom extensions (superscript, subscript, math-block, math-inline) + 1 regex (abbreviation definitions only). https://claude.ai/code/session_01NXoimZjyg4zz55zx1YXi7W
Diagnostics must flag every inline occurrence of an abbreviated term, not just the definition line. Regex can't reliably find term occurrences inside code spans or link URLs. All 12 features now detected via AST with 5 custom goldmark extensions (~1250 LOC total with tests), zero regex fallback. https://claude.ai/code/session_01NXoimZjyg4zz55zx1YXi7W
Replaced verbose tables with prose, trimmed redundant sections. 170 lines (under 300 max), no lines over 80 chars, no tables needing pad formatting. Fixes mdsmith CI check failure. https://claude.ai/code/session_01NXoimZjyg4zz55zx1YXi7W
- Convert inline code paths to Markdown links per plan template - Note sync.Once caching for dual parser (rule cloning concern) - Fix task 11: implement rule.Configurable, not add interface https://claude.ai/code/session_01NXoimZjyg4zz55zx1YXi7W
internal/rules/markdownflavor/ext/ does not exist yet, so the Markdown link breaks the strict cross-file-reference check. Use backticked path (allowed for placeholders per CLAUDE.md). https://claude.ai/code/session_01NXoimZjyg4zz55zx1YXi7W
Break 59-word single sentence into shorter sentences (max 40 words per sentence). Update PI parser reference to include both pi_parser.go and pi.go. Clarify parser caching must be package-level, not per-clone. https://claude.ai/code/session_01NXoimZjyg4zz55zx1YXi7W
Split paragraphs to reduce readability index below 14.0 and sentence count below 6. Verified clean with mdsmith check. https://claude.ai/code/session_01NXoimZjyg4zz55zx1YXi7W
The rebase silently reverted config changes from main: lost directory-structure rule, docs/security and docs/research overrides, cross-file-reference exclude path fix, and AGENTS-PR-FIXUP.md path fix. Restore by checking out from origin/main. https://claude.ai/code/session_01NXoimZjyg4zz55zx1YXi7W
Use mdsmith fix to regenerate PLAN.md instead of hand-editing. Rename "autolinks" to "bare-URL autolinks" throughout plan 86 to distinguish from CommonMark's <...> autolinks. https://claude.ai/code/session_01NXoimZjyg4zz55zx1YXi7W
…interaction - Constrain bare-URL autolink fix to scheme-bearing URLs; www.-only URLs use explicit Markdown link syntax instead - List exact features accepted/flagged by flavor: goldmark - Replace vague "no conflict with MDS012" criterion with specific per-flavor behavior for bare-URL diagnostics https://claude.ai/code/session_01NXoimZjyg4zz55zx1YXi7W
Explicitly list every accepted and flagged feature for commonmark, gfm, and goldmark flavors so the planned registry and test fixtures are unambiguous. https://claude.ai/code/session_01NXoimZjyg4zz55zx1YXi7W
Replace vague "and five others" with explicit list of all 12 features that vary across flavors, matching the acceptance criteria. https://claude.ai/code/session_01NXoimZjyg4zz55zx1YXi7W
- Replace vague Pandoc flanking description with explicit rules, allow/deny examples, and spec link - Expand task-list auto-fix to cover all bullet markers and checked/unchecked states https://claude.ai/code/session_01NXoimZjyg4zz55zx1YXi7W
…tensions Align narrative with acceptance criteria: goldmark for MDS034 means the default config (GFM-like features + heading IDs), not all optional extensions. https://claude.ai/code/session_01NXoimZjyg4zz55zx1YXi7W
…task - Rephrase goldmark flavor as an mdsmith-defined profile, not upstream Goldmark defaults - Add explicit task to implement rule.Defaultable for opt-in behavior https://claude.ai/code/session_01NXoimZjyg4zz55zx1YXi7W
jeduden
force-pushed
the
claude/markdown-flavor-validation-QNVtV
branch
from
April 7, 2026 06:38
6ad0b3d to
0c470f3
Compare
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
This PR adds a comprehensive design plan for MDS034, a new opt-in rule that validates Markdown files against a declared flavor (CommonMark, GFM, or Goldmark) and reports unsupported syntax with auto-fix capabilities where applicable.
Key Changes
New planning document (
plan/86_markdown-flavor-validation.md): Detailed specification for MDS034 including:Updated PLAN.md: Added entry for plan Add research and implementation plans for directive unification #86 in the roadmap
Notable Implementation Details
$x+y$(math) fromcosts $5(currency) and$PATH(environment variables)https://claude.ai/code/session_01NXoimZjyg4zz55zx1YXi7W