pentagi icon indicating copy to clipboard operation
pentagi copied to clipboard

fix: handle nested backticks in markdown code block rendering

Open sridhar-3009 opened this issue 4 months ago • 1 comments

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

sridhar-3009 avatar Jul 09 '26 19:07 sridhar-3009

A useful edge-case test would include nested Markdown where the inner backtick run appears inside an indented list or blockquote, since fence recognition can depend on the container prefix. It may also be worth testing a body containing several backtick runs of different lengths and confirming the preprocessor chooses exactly one longer outer fence. Finally, code spans outside fenced blocks should remain byte-for-byte unchanged.

hiSandog avatar Jul 11 '26 04:07 hiSandog

Thanks for the patch. We are not taking this: on the input from the linked issue the rendered structure does not change. Closing this PR.

sirozha avatar Sep 23 '26 12:09 sirozha