fix: escape curly braces in docstring prose (MDX JSX parse failures)#45
Merged
Conversation
… as JSX
Two related MDX parse failures in generated docs:
1. Bare `{...}` in docstring prose (e.g. a dict example) was passed through
unescaped. MDX treats `{` as a JSX expression delimiter, so Mintlify failed
with "Unable to parse ... Unexpected lazy line in expression in container".
escape_mdx_content now escapes `{`/`}` (to `\{`/`\}`) outside code.
2. The inline-code pattern matched backtick spans across newlines. MDX does NOT
treat a multi-line backtick span as code, so braces inside it still reached
the parser unescaped. Inline code is now matched single-line only; multi-line
backtick content falls through to the prose escaper.
Regression tests cover bare-brace prose, braces preserved inside real code
spans/fences, and braces inside a multi-line backtick span.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Jun 22, 2026
zzstoatzz
added a commit
that referenced
this pull request
Jun 22, 2026
Reverts the brace-escaping added in 0.2.43/0.2.44. It degraded output (turning backtick-wrapped inline code into backslash-escaped braces) and was the wrong layer to address MDX parse issues. Restores formatter.py to its pre-#45 state; the empty-module and navigation fixes from 0.2.40-0.2.42 are unaffected. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found while regenerating Prefect's integration docs — Mintlify's MDX parser (
mint broken-links) failed on generated files with "Unable to parse … expression in container".Two related causes, both fixed here:
{...}in docstring prose (e.g. a dict example like{"python_params": [...]}) was emitted unescaped. MDX treats{as a JSX expression delimiter.escape_mdx_contentnow escapes{/}→\{/\}outside code.Verified: regenerating Prefect's full integration docs and running
npx mint broken-links→ "success no broken links found" (previously hard-failed). Regression tests added for all three cases (prose braces, braces preserved in real code, braces in a multi-line span).🤖 Generated with Claude Code