| … | … | @@ -0,0 +1,43 @@ | |
| 1 | + | // Definitions, footnotes, raw HTML, container directives and display math can tie blocks together. | |
| 2 | + | const DOCUMENT_WIDE_SYNTAX = /^ {0,3}(?:\[[^\]\n]+\]:|<[A-Za-z!?/]|:::|\$\$)|\[\^/m; | |
🟡 Medium chat/markdownStreamBlocks.ts:2
splitMarkdownBlocks splits [foo]\n\n> [foo]: /url into separate documents, so the preceding reference stays literal instead of rendering as a link. DOCUMENT_WIDE_SYNTAX misses definitions inside blockquotes, as well as multiline or escaped-] labels; detect these definitions too or use parsed definition nodes to trigger the whole-document fallback.
🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
| 1 | In file @apps/web/src/components/chat/markdownStreamBlocks.ts around line 2: |
| 2 | |
| 3 | `splitMarkdownBlocks` splits `[foo]\n\n> [foo]: /url` into separate documents, so the preceding reference stays literal instead of rendering as a link. `DOCUMENT_WIDE_SYNTAX` misses definitions inside blockquotes, as well as multiline or escaped-`]` labels; detect these definitions too or use parsed definition nodes to trigger the whole-document fallback. |
| … | … | @@ -1668,21 +1714,20 @@ function ChatMarkdown({ | |
| 1670 | 1716 | <ChatMarkdownRendererContext value={componentState}> | |
| 1671 | - | <ChatMarkdownTextContext value={text}> | |
| 1672 | - | <ReactMarkdown | |
| 1717 | + | {(streamingBlocks ?? [text]).map((source, index) => ( | |
🟡 Medium components/ChatMarkdown.tsx:1717
While a reply is streaming, duplicate headings in separate streamingBlocks are rendered by separate ReactMarkdown trees, so both receive user-content-setup instead of the second receiving user-content-setup-1; [second](#setup-1) therefore cannot resolve until streaming finishes. Preserve document-wide slug allocation across blocks or fall back to whole-document rendering when slugs repeat.
🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
| 1 | In file @apps/web/src/components/ChatMarkdown.tsx around line 1717: |
| 2 | |
| 3 | While a reply is streaming, duplicate headings in separate `streamingBlocks` are rendered by separate `ReactMarkdown` trees, so both receive `user-content-setup` instead of the second receiving `user-content-setup-1`; `[second](#setup-1)` therefore cannot resolve until streaming finishes. Preserve document-wide slug allocation across blocks or fall back to whole-document rendering when slugs repeat. |
| … | … | @@ -0,0 +1,43 @@ | |
| 26 | + | ) { | |
| 27 | + | fence = null; | |
| 28 | + | } | |
| 29 | + | } else if (line.trim() === "") { | |
🟢 Low chat/markdownStreamBlocks.ts:29
A line containing only NBSP is treated as a blank line, so one\n\u00a0\ntwo is split into two blocks even though CommonMark parses it as one paragraph. Check for ASCII spaces and tabs only when detecting blank lines.
| 1 | } else if (/^[ \t]*$/.test(line)) { |
🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
| 1 | In file @apps/web/src/components/chat/markdownStreamBlocks.ts around line 29: |
| 2 | |
| 3 | A line containing only NBSP is treated as a blank line, so `one\n\u00a0\ntwo` is split into two blocks even though CommonMark parses it as one paragraph. Check for ASCII spaces and tabs only when detecting blank lines. |