Skip to content

fix(spec): escape unmatched </{ in generated MDX docs (unblock apps/docs build)#1493

Merged
xuyushun441-sys merged 2 commits into
mainfrom
fix/docs-mdx-manifest
Jun 1, 2026
Merged

fix(spec): escape unmatched </{ in generated MDX docs (unblock apps/docs build)#1493
xuyushun441-sys merged 2 commits into
mainfrom
fix/docs-mdx-manifest

Conversation

@xuyushun441-sys

Copy link
Copy Markdown
Contributor

Summary

Unblocks main — the apps/docs Next.js (Turbopack + fumadocs-mdx) production build currently fails:

./content/docs/references/kernel/manifest.mdx
82:97: Unexpected character `5` (U+0035) before name, expected a character that can start a name

(This is a docs-build regression unrelated to the validation-rules work; it surfaced once the #1485#1490 platform-objects regression was cleared and the pipeline reached the docs build.)

Root cause

packages/spec/scripts/build-docs.ts generates the reference MDX from the Zod schemas. Its escapeMdxDescription only backtick-wrapped matched <…> / {…} pairs. A lone < with no closing partner — e.g. the SemVer range in manifest's platform field, .describe('... ">=4.0 <5"') — was emitted raw, and MDX read the <5 as the start of a JSX tag.

Fix

  • An unmatched < / { is now emitted as its HTML entity (&lt; / &#123;) so it renders literally and never opens a JSX/expression node. Matched pairs keep their existing backtick-wrapping; fragments already inside inline-code spans are still left untouched.
  • Union-variant descriptions (previously emitted raw) now also go through the escaper.

Only the generator changes — the committed generated .mdx is regenerated by the build (gen:schema && gen:docs && next build), so no generated content is included here.

Verification

pnpm --filter @objectstack/docs build (full gen + next build) completes successfully. A sweep of all generated content/docs/references/** confirms no remaining unmatched < outside code spans (>=2.0.0 <3.0.0 style ranges are inside backticks and unaffected).

🤖 Generated with Claude Code

os-zhuang and others added 2 commits June 2, 2026 05:11
…ps/docs build)

`build-docs.ts`'s `escapeMdxDescription` only backtick-wrapped *matched*
`<…>` / `{…}` pairs. A lone `<` with no closing partner — e.g. a SemVer
range in a `.describe()` like `">=4.0 <5"` — leaked into the generated MDX,
where Turbopack/fumadocs read the `<` as the start of a JSX tag and failed
the docs build:

  ./content/docs/references/kernel/manifest.mdx
  82:97: Unexpected character `5` (U+0035) before name

Now an unmatched `<` / `{` is replaced with its HTML entity (`&lt;` / `&#123;`)
so it renders literally and never opens a JSX/expression node. Also routes
union-variant descriptions through the same escaper (previously emitted raw).

Verified: `pnpm --filter @objectstack/docs build` (gen:schema + gen:docs +
next build) now completes; no remaining unmatched `<` outside code spans
across the generated references.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
spec Ready Ready Preview, Comment Jun 1, 2026 9:15pm

Request Review

@github-actions github-actions Bot added documentation Improvements or additions to documentation tooling size/s labels Jun 1, 2026
@xuyushun441-sys xuyushun441-sys merged commit 8fa1e7f into main Jun 1, 2026
12 checks passed
@xuyushun441-sys xuyushun441-sys deleted the fix/docs-mdx-manifest branch June 1, 2026 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/s tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants