fix(ci): add MDX safety check for non-self-closing img tags#1215
Conversation
fern check validates Fern configuration only — non-self-closing <img> tags pass fern check but cause fern generate to fail with "Unexpected closing tag </p>". Add a grep-based step that catches this before merge, covering docs/ and fern/ for *.md and *.mdx. Root-caused from a live failure in NVIDIA/topograph#281. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
📝 WalkthroughWalkthroughA new CI step was added to the Fern documentation workflow that scans markdown and MDX files in the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/fern-docs-ci.yml:
- Around line 62-63: The current BAD=$(grep -rn '<img\b[^>]*[^/]>' docs/ fern/
--include="*.md" --include="*.mdx" || true) misses multiline <img> tags; replace
this line with a multiline-safe scan that slurps each .md/.mdx file and matches
<img ...> across newlines while excluding self-closing tags, e.g. use a Perl
one-liner (using -0777) or grep/pcre with the -z/-P flags to match across lines
and only report matches that do not end with "/>"; keep the rest of the
conditional (if [ -n "$BAD" ]; then) the same so the CI fails when such
multiline non-self-closing <img> tags are found.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 21b92d88-cec3-4e34-96c8-153f8103186a
📒 Files selected for processing (1)
.github/workflows/fern-docs-ci.yml
Extend the grep to cover fern/ and *.mdx in addition to docs/*.md. Add comments explaining the inline and single-line choices. Matches the pattern settled on in NVIDIA/NVSentinel#1215 and NVIDIA/aicr#620. Signed-off-by: Pete MacKinnon <[email protected]>
Extend the grep to cover fern/ and *.mdx in addition to docs/*.md. Add comments explaining the inline and single-line choices. Matches the pattern settled on in NVIDIA/NVSentinel#1215 and NVIDIA/aicr#620. Signed-off-by: Pete MacKinnon <[email protected]>
Extend the grep to cover fern/ and *.mdx in addition to docs/*.md. Add comments explaining the inline and single-line choices. Matches the pattern settled on in NVIDIA/NVSentinel#1215 and NVIDIA/aicr#620. Signed-off-by: Pete MacKinnon <[email protected]>
) Co-authored-by: Claude Sonnet 4.6 <[email protected]>
Summary
Add a grep-based MDX safety step to
fern-docs-ci.ymlthat catches non-self-closing<img>tags before merge. Coversdocs/andfern/for both*.mdand*.mdxfiles.fern checkvalidates Fern configuration only — non-self-closing<img>tags passfern checkbut causefern generateto fail withUnexpected closing tag </p>. Root-caused from a live failure in NVIDIA/topograph#281, fixed in NVIDIA/aicr#620.Fixes #1214
Type of Change
Component(s) Affected
Testing
Checklist
Summary by CodeRabbit