Skip to content

fix: escape curly braces in generated MDX docs#601

Merged
hotlong merged 2 commits into
mainfrom
copilot/fix-vercel-build-issue
Feb 11, 2026
Merged

fix: escape curly braces in generated MDX docs#601
hotlong merged 2 commits into
mainfrom
copilot/fix-vercel-build-issue

Conversation

Copilot AI commented Feb 11, 2026

Copy link
Copy Markdown
Contributor

Vercel docs build fails on execution-context.mdx because getFileDescription() extracts JSDoc containing { context: { userId: '...' } } and inserts it as raw MDX, where {} are parsed as JSX expressions.

  • packages/spec/scripts/build-docs.ts: Escape {\{ and }\} in getFileDescription() after {@link} tag processing
.replace(/\{@link\s+([^|]+?)\s*\|\s*([^}]+?)\s*\}/g, '[$2]($1)')
.replace(/\{@link\s+([^}]+?)\s*\}/g, '[$1]($1)')
.replace(/file:\/\//g, '')
.replace(/\{/g, '\\{').replace(/\}/g, '\\}') // ← added
  • 20 regenerated MDX files: All auto-generated reference docs with curly braces in JSDoc descriptions now have properly escaped braces

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@vercel

vercel Bot commented Feb 11, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
objectstack-play Ready Ready Preview, Comment Feb 11, 2026 4:18am
spec Ready Ready Preview, Comment Feb 11, 2026 4:18am

Request Review

The getFileDescription() function in build-docs.ts now escapes { and }
characters in extracted JSDoc text, preventing MDX from interpreting
them as JSX expressions. Regenerated all affected MDX docs.

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix Vercel build issue for execution context fix: escape curly braces in generated MDX docs Feb 11, 2026
Copilot AI requested a review from hotlong February 11, 2026 03:11
@hotlong
hotlong marked this pull request as ready for review February 11, 2026 03:15
Copilot AI review requested due to automatic review settings February 11, 2026 03:15
@hotlong

hotlong commented Feb 11, 2026

Copy link
Copy Markdown
Collaborator

@copilot 确认一下这个文件是不是是用脚本自动生成的?

Copilot AI commented Feb 11, 2026

Copy link
Copy Markdown
Contributor Author

@copilot 确认一下这个文件是不是是用脚本自动生成的?

是的,content/docs/references/kernel/execution-context.mdx 是由 packages/spec/scripts/build-docs.ts 脚本自动生成的。

流程:gen:schema(Zod → JSON Schema)→ gen:docs(JSON Schema + JSDoc → MDX)→ next build

具体来说,build-docs.tsgenerateZodFileMarkdown() 函数读取 packages/spec/src/kernel/execution-context.zod.ts 的 JSDoc 注释(通过 getFileDescription()),然后生成对应的 MDX 文件。这次修复就是在 getFileDescription() 中对提取出的 JSDoc 内容中的 {} 做转义,防止 MDX 将其解析为 JSX 表达式。

Copilot AI 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.

Pull request overview

Fixes MDX build failures caused by unescaped {} in file-level JSDoc descriptions being inserted into generated reference docs (MDX parses {} as JSX/expressions).

Changes:

  • Updated getFileDescription() in packages/spec/scripts/build-docs.ts to escape { and } in extracted JSDoc.
  • Regenerated reference MDX pages so curly braces in extracted descriptions no longer break the docs build.

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/spec/scripts/build-docs.ts Escapes curly braces in extracted JSDoc descriptions to prevent MDX JSX parsing errors.
content/docs/references/ui/widget.mdx Regenerated docs; code examples now include escaped braces.
content/docs/references/system/worker.mdx Regenerated docs; code examples now include escaped braces.
content/docs/references/system/translation.mdx Regenerated docs; code examples now include escaped braces.
content/docs/references/system/notification.mdx Regenerated docs; template/code examples now include escaped braces.
content/docs/references/studio/plugin.mdx Regenerated docs; TS example braces now escaped.
content/docs/references/shared/mapping.mdx Regenerated docs; TS example braces now escaped.
content/docs/references/security/rls.mdx Regenerated docs; TS example braces now escaped.
content/docs/references/kernel/execution-context.mdx Regenerated docs; usage snippet braces now escaped.
content/docs/references/data/validation.mdx Regenerated docs; TS example braces now escaped.
content/docs/references/data/external-lookup.mdx Regenerated docs; JSON example braces now escaped.
content/docs/references/data/document.mdx Regenerated docs; JSON example braces now escaped.
content/docs/references/automation/trigger-registry.mdx Regenerated docs; TS example braces now escaped.
content/docs/references/automation/sync.mdx Regenerated docs; TS example braces now escaped.
content/docs/references/automation/etl.mdx Regenerated docs; TS example braces now escaped.
content/docs/references/api/registry.mdx Regenerated docs; TS example braces now escaped.
content/docs/references/api/plugin-rest-api.mdx Regenerated docs; JSON example braces now escaped.
content/docs/references/api/odata.mdx Regenerated docs; TS example braces now escaped.
content/docs/references/api/graphql.mdx Regenerated docs; GraphQL example braces now escaped.
content/docs/references/api/documentation.mdx Regenerated docs; TS example braces now escaped.
content/docs/references/ai/devops-agent.mdx Regenerated docs; TS example braces now escaped.

Comment on lines 119 to +122
.replace(/\{@link\s+([^|]+?)\s*\|\s*([^}]+?)\s*\}/g, '[$2]($1)') // {@link url | text} -> [text](url)
.replace(/\{@link\s+([^}]+?)\s*\}/g, '[$1]($1)') // {@link url} -> [url](url)
.replace(/file:\/\//g, '') // Remove file:// protocol
.replace(/\{/g, '\\{').replace(/\}/g, '\\}') // Escape { } for MDX

Copilot AI Feb 11, 2026

Copy link

Choose a reason for hiding this comment

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

The new global {/} escaping runs across the entire extracted JSDoc, including fenced code blocks. In MDX, braces inside triple-backtick code fences are already safe, so this change makes generated examples render with literal backslashes and breaks copy/paste (e.g. GraphQL/TS object literals become \{ ... \}). Consider escaping braces only in non-code segments (outside fenced code blocks, and ideally outside inline backticks as well), so MDX build errors are fixed without degrading code samples.

Copilot uses AI. Check for mistakes.
@hotlong
hotlong merged commit 4c2e32e into main Feb 11, 2026
8 of 10 checks passed
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