fix(docs/ci): self-close img tags and add MDX safety check to CI#282
Conversation
docs/architecture.md:11 had a non-self-closing <img> tag, causing a parse error in fern generate. fern check does not catch MDX content errors, so add an explicit grep step to fern-docs-ci.yml that fails CI on any non-self-closing <img> tag in docs/. Fixes NVIDIA#281 Signed-off-by: Pete MacKinnon <[email protected]>
Greptile SummaryThis PR fixes a non-self-closing Confidence Score: 5/5Safe to merge; the doc fix is correct and the only finding is a minor P2 false-positive risk in the CI grep. Both changes are small and correct. The single P2 comment about grep matching inside code blocks is speculative (no current docs trigger it) and does not affect correctness of the primary fix. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Push to docs/** or fern/**] --> B[Check markdown filename conventions]
B --> C[Setup Node.js + Install Fern CLI]
C --> D{Check MDX safety\ngrep non-self-closing img tags}
D -- found --> E[❌ CI fails with error annotation]
D -- clean --> F[fern check]
F --> G[Check links - lychee offline]
G --> H[✅ CI passes]
Reviews (1): Last reviewed commit: "fix(docs/ci): self-close img tags and ad..." | Re-trigger Greptile |
|
|
||
| - name: Check MDX safety | ||
| run: | | ||
| BAD=$(grep -rn '<img\b[^>]*[^/]>' docs/ --include="*.md" || true) |
There was a problem hiding this comment.
Grep will match inside fenced code blocks
The raw grep approach doesn't distinguish between live MDX content and examples inside backtick fences or <code> blocks. A doc that demonstrates the wrong pattern (e.g., `<img src="x">`) would cause a spurious CI failure. Excluding code-fence lines with a two-step pipe keeps the check accurate:
| BAD=$(grep -rn '<img\b[^>]*[^/]>' docs/ --include="*.md" || true) | |
| BAD=$(grep -rn '<img\b[^>]*[^/]>' docs/ --include="*.md" | grep -v '^\s*```\|^\s*`' || true) |
Also worth noting: the --include="*.md" glob would miss any .mdx files added in the future; consider adding --include="*.mdx" as well.
Description
docs/architecture.md:11had a non-self-closing<img>tag, causing an MDX parse error atfern generatetime.fern checkdoes not validate MDX content so this slipped through CI.Two-part fix:
<img>tag inarchitecture.mdCheck MDX safetystep tofern-docs-ci.ymlthat greps for non-self-closing<img>tags and fails CI before merge — so this class of error can't recur undetectedFixes #281
Checklist
git commit -s).