Skip to content

fix(schema-generator): keep braces unescaped in inline code - #3045

Open
connorburgess wants to merge 1 commit into
agentclientprotocol:mainfrom
connorburgess:cb/generator-braces-in-code-spans
Open

connorburgess wants to merge 1 commit into
agentclientprotocol:mainfrom
connorburgess:cb/generator-braces-in-code-spans

Conversation

@connorburgess

Copy link
Copy Markdown

Problem

The reference generator escapes { and } in descriptions, because MDX reads braces as an expression. It also escapes them inside inline code, where a backslash is literal. The published reference therefore shows \{\} wherever a description says that supplying {} advertises a capability.

It is visible today on https://agentclientprotocol.com/protocol/v1/schema, for example under sessionCapabilities: the v1 page has 29 such lines.

Change

escape_mdx in schema-generator/src/main.rs now tracks inline code and leaves braces alone inside it. Braces in prose, pipes and angle brackets are escaped as before.

The four reference pages are regenerated. No \{ remains in any of them. Prettier also reformats a few fields that it could not parse before; their text is unchanged. The published JSON Schemas are unchanged.

Hand-written pages already use {} inside inline code within the same components (for example docs/protocol/v1/initialization.mdx), so the generated form matches what already builds.

Testing

  • New test escape_mdx_keeps_braces_in_inline_code fails before the change and passes after.
  • npm run check passes locally (Clippy, format, spellcheck, cargo test --all-features, schema tests).

The reference generator escapes braces in descriptions because MDX
reads them as an expression. It also escaped them inside inline code,
where a backslash is literal, so the published reference shows
`\{\}` wherever a description says that supplying `{}` advertises
a capability. The v1 reference page has 29 such lines.

Track inline code while escaping and leave braces alone inside it.
Prose braces, pipes and angle brackets are escaped as before.

Regenerated the four reference pages. Besides the removed backslashes,
Prettier now reformats a few fields it previously left alone, since it
can parse them. Their text is unchanged. Published JSON Schemas are
unchanged.
@connorburgess
connorburgess requested a review from a team as a code owner December 5, 2026 08:18
@mintlify

mintlify Bot commented Dec 5, 2026

Copy link
Copy Markdown

Preview approval required

This pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit 3e23329.

Approve preview

This branch has not been deployed

No deployments
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.

1 participant