Skip to content

fix: handle nested backticks in markdown code block rendering#370

Open
sridhar-3009 wants to merge 1 commit into
vxcontrol:mainfrom
sridhar-3009:fix/markdown-nested-backticks-361
Open

fix: handle nested backticks in markdown code block rendering#370
sridhar-3009 wants to merge 1 commit into
vxcontrol:mainfrom
sridhar-3009:fix/markdown-nested-backticks-361

Conversation

@sridhar-3009

Copy link
Copy Markdown

Add a preprocessMarkdownFences() step in the Markdown component that auto-extends the outer fence when a code block body contains a backtick run long enough to prematurely close it, preventing the renderer from splitting a single block into two.

Closes #361

…rol#361)

Add preprocessMarkdownFences() that scans markdown line-by-line before
passing it to ReactMarkdown. When a fenced code block body contains a
backtick run long enough to prematurely close the outer fence, the outer
fence is extended by one backtick beyond the longest such inner run.
This conforms to the CommonMark spec and prevents the renderer from
splitting a single code block into two when the content includes triple
(or longer) backtick sequences on their own line.
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.

[Bug]: Triple backticks inside code blocks break markdown rendering

1 participant