Skip to content

Add MDX documentation validation to verify workflow#65

Merged
gontzess merged 1 commit intomainfrom
gontzess/mdx-lint
Mar 24, 2026
Merged

Add MDX documentation validation to verify workflow#65
gontzess merged 1 commit intomainfrom
gontzess/mdx-lint

Conversation

@gontzess
Copy link
Copy Markdown
Contributor

Why

Malformed MDX in docs/connector.mdx (e.g. unclosed tags, indented closing tags, unknown components) causes the registry's documentation compiler to fail silently. The broken docs get recorded but never compiled to HTML, so they never render in the UI. Currently there's no way to catch this before merge.

What this changes

Adds a docs job to the reusable verify workflow that compiles docs/connector.mdx using the same MDX compiler the registry uses. Runs on every PR in every connector repo.

  • tools/mdx-lint/mdx-compile.mjs — the compiler (same as in the registry-api repo)
  • tools/mdx-lint/package.json — minimal Node dependencies
  • Only runs if docs/connector.mdx exists (most connectors have it)
  • Annotates the file with the error on failure

Example failure this would catch: baton-zuora has </Warning> indented inside a list item, which breaks the MDX parser.

Adds a docs job to the reusable verify workflow that validates
docs/connector.mdx using compile-only MDX parsing (no eval/execution).
Catches malformed tags, unclosed components, and unknown component names
before they reach main.

Security:
- Compile-only: uses @mdx-js/mdx compile() without run(). No code from
  the PR is executed — safe for untrusted external contributor PRs.
- Component allowlist checked against compiled output (not regex on raw
  MDX) to avoid false positives from angle brackets in inline text.
- Minimal deps: @mdx-js/mdx, remark-gfm, remark-frontmatter only.
  No react/react-dom (only needed for rendering, not validation).

The lint script is written inline in the workflow step (no cross-repo
checkout needed). Packages are installed to /tmp/mdx-lint at runtime.
Error messages show directly in the GitHub Actions log with file
annotation on docs/connector.mdx.
@gontzess gontzess merged commit 223e440 into main Mar 24, 2026
1 check passed
@gontzess gontzess deleted the gontzess/mdx-lint branch March 24, 2026 21:24
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.

3 participants