Open
Conversation
Introduce `markdown:lint` which chains structural markdown checks (markdownlint-cli2) and Mermaid diagram validation. Both run as part of `mise run lint` and as a dedicated GitHub Actions job. Mermaid diagrams are validated by calling `mermaid.parse()` via a small Node script with a jsdom shim — no Chromium/Puppeteer required. This catches real parse errors (e.g. the `exec()s` sequence-diagram bug in `architecture/sandbox-connect.md`) that browser-free alternatives like `maid` silently miss. Tooling: - `.markdownlint-cli2.jsonc` with `gitignore: true`, sensible rule overrides (MD033 allowlist for GitHub-rendered HTML, MD060 padded table style, MD013/MD034 off to match project style). - `docs/.markdownlint-cli2.jsonc` overrides for MDX (no top-level H1, JSX components may look like HTML). - `scripts/lint-mermaid/` hosts the validator with a committed `package-lock.json` for reproducible CI installs (`npm ci`). - `markdownlint-cli2` pinned via mise `npm:` backend. Existing doc fixes applied to satisfy the new checks: adds `text` language to bare code fences (via one-shot codemod), corrects list indentation at the single-digit → double-digit boundary in `architecture/sandbox.md`, plus minor blank-line and trailing-newline fixes.
|
🌿 Preview your docs: https://nvidia-preview-pr-933.docs.buildwithfern.com/openshell |
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
mise run markdown:lintwhich chainsmarkdownlint-cli2(structural markdown) and a Mermaid validator that calls the officialmermaid.parse()via a jsdom shim — no Chromium/Puppeteer required.Markdownjob inbranch-checks.yml.Why
mermaid.parse()(tooling research)Evaluated several options before landing on the official
mermaidnpm package + jsdom:@mermaid-js/mermaid-cli(mmdc) — uses the real parser/renderer, but pulls Puppeteer + Chromium (~300MB). Too heavy for pre-commit; CI-only at best.@probelabs/maid— fast, Chevrotain-based. Rejected: produced false positives AND missed a real error in this repo (theexec()ssequence-diagram bug inarchitecture/sandbox-connect.md).go-mermaid— pure Go single binary, but custom parser that lags the official grammar. Would drift silently.@mermaid-js/parser(Langium, official) — library only, currently covers only a subset of diagram types (flowchart/sequence/class still partly on the legacy Jison grammar insidemermaid). Incomplete for our mix.mermaid.parse()from themermaidpackage — chosen. Uses the same grammar that actually renders on GitHub and in Fern previews (so "passes here" == "renders there"), needs only a small jsdom shim, runs in ~2s across the repo.Long-form rationale lives in the header comment of
scripts/lint-mermaid/lint-mermaid.mjs.Changes
Tooling
.markdownlint-cli2.jsonc— root config.gitignore: true, rule overrides for project style (MD013off,MD033allowlist,MD024 siblings_only,MD034off,MD060 padded).docs/.markdownlint-cli2.jsonc— per-directory MDX override (MD041,MD033off for JSX/frontmatter).scripts/lint-mermaid/— Node validator (lint-mermaid.mjs) pluspackage.json+ committedpackage-lock.json. CI installs vianpm cifrom the lockfile for reproducible, deterministic builds — deps are pinned and won't drift.tasks/markdown.toml—markdown:lint,markdown:lint:md,markdown:lint:mermaid,markdown:format,markdown:deps(misesources/outputscache the install).mise.toml—"npm:markdownlint-cli2" = "0.15.0"so contributors get the CLI viamise install.tasks/ci.toml— wiresmarkdown:lintinto the umbrellalinttask..github/workflows/branch-checks.yml— newMarkdownjob.Doc cleanups to satisfy the new checks
textlanguage to 43 previously-bare code fences across 21 files (via one-shot codemod, kept in-tree asscripts/lint-mermaid/default-fence-lang.mjs).architecture/sandbox.md(CommonMark requires 4-space sub-bullet indent under10.).Testing
mise run markdown:lint— 0 errors across 73 markdown files + 80 mermaid-scanned files.exec()sparse error thatmaidand@mermaid-js/parserpreviously missed.npm ciinscripts/lint-mermaid/reproduces the exact lockfile.Checklist