Skip to content

fix(ci): add MDX safety check for non-self-closing img tags#1215

Merged
lalitadithya merged 1 commit into
NVIDIA:mainfrom
pdmack:pdmack/fern-mdx-safety-ci
Apr 20, 2026
Merged

fix(ci): add MDX safety check for non-self-closing img tags#1215
lalitadithya merged 1 commit into
NVIDIA:mainfrom
pdmack:pdmack/fern-mdx-safety-ci

Conversation

@pdmack

@pdmack pdmack commented Apr 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add a grep-based MDX safety step to fern-docs-ci.yml that catches non-self-closing <img> tags before merge. Covers docs/ and fern/ for both *.md and *.mdx files.

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>. Root-caused from a live failure in NVIDIA/topograph#281, fixed in NVIDIA/aicr#620.

Fixes #1214

Type of Change

  • 🐛 Bug fix
  • 🔨 Build/CI

Component(s) Affected

  • Documentation/CI

Testing

  • Manual testing completed
  • No breaking changes (or documented)

Checklist

  • Self-review completed
  • Ready for review

Summary by CodeRabbit

  • Chores
    • Added validation step to CI pipeline to check documentation files for improperly formatted image tags, ensuring consistent code quality standards.

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]>
@coderabbitai

coderabbitai Bot commented Apr 20, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

A new CI step was added to the Fern documentation workflow that scans markdown and MDX files in the docs/ and fern/ directories for non-self-closing <img> tags. If any violations are detected, the workflow emits an error annotation and fails the job.

Changes

Cohort / File(s) Summary
CI Image Tag Validation
.github/workflows/fern-docs-ci.yml
Added validation step using grep to detect non-self-closing <img> tags in markdown documentation files; failure triggers workflow error and halts subsequent steps.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A guardian of tags so fine,
Ensures each image ends with />
No stray <img> shall cross the line,
The workflow checks and seals the route! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding an MDX safety check for non-self-closing img tags to the CI workflow.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between ef144ba and 6a20d39.

📒 Files selected for processing (1)
  • .github/workflows/fern-docs-ci.yml

Comment thread .github/workflows/fern-docs-ci.yml
@github-actions

Copy link
Copy Markdown
Contributor

@pdmack pdmack requested a review from lalitadithya April 20, 2026 19:06
@lalitadithya lalitadithya merged commit 8baacc0 into NVIDIA:main Apr 20, 2026
50 checks passed
pdmack added a commit to pdmack/topograph that referenced this pull request Apr 20, 2026
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]>
pdmack added a commit to pdmack/topograph that referenced this pull request Apr 20, 2026
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]>
dmitsh pushed a commit to NVIDIA/topograph that referenced this pull request Apr 20, 2026
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]>
KaivalyaMDabhadkar pushed a commit to KaivalyaMDabhadkar/NVSentinel that referenced this pull request Apr 24, 2026
@pdmack pdmack deleted the pdmack/fern-mdx-safety-ci branch May 10, 2026 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: fern-docs-ci missing MDX safety check for non-self-closing img tags

2 participants