fix: address markdown renderer review findings

Restore the replaced pipeline's synthetic fence newline so a real trailing
blank line inside a fence survives CodeBlock's display trim, and pin it
plus header-only tables in the DOM-parity corpus. Route
extractMarkdownPlainText through parseGfm so the grammar has one source.
Document the fixture provenance check (all 46 fixtures reproduce
byte-identically from react-markdown at 9e8101b800), the deliberate
O(prefix) divergence memcmp, the per-arm scope of grammar consistency,
the React 18 MathML namespace limitation, and the prefix-equivalence
corpus constraint.
This commit is contained in:
07akioni
2026-08-06 14:58:33 +08:00
parent d1e4fb91d2
commit 31b99930d9
14 changed files with 152 additions and 21 deletions
@@ -279,7 +279,10 @@ function renderCode(node: Md.Code, key: Key, context: MarkdownRenderContext): Re
return (
<CodeBlock
key={key}
code={node.value}
// The replaced hast pipeline appended one synthetic newline that
// CodeBlock's display trim removes; feeding the bare value would make
// that trim eat a REAL trailing blank line inside the fence instead.
code={`${node.value}\n`}
lang={context.streaming ? undefined : lang}
copyLabel={context.codeLabels?.copyLabel}
copiedLabel={context.codeLabels?.copiedLabel}