Commit 3a84ef4
authored
🤖 fix: disable incomplete markdown parsing for completed content (#909)
## Summary
The remend library (used by streamdown for `parseIncompleteMarkdown`)
has a bug where content like `$__timeFilter` causes trailing `__` to be
added to the output. This happens because remend counts all `__` in the
entire string without respecting code block boundaries.
## Fix
Only enable `parseIncompleteMarkdown` during actual streaming, not for
completed/historical content. This prevents the bug while still
providing the streaming UX benefit.
## Root Cause
`remend@1.0.1` counts markdown emphasis markers (`__`) globally rather
than excluding fenced code blocks, causing false 'repairs'.
Example buggy input:
```markdown
```sql
SELECT * WHERE $__timeFilter(x)
```
```
Would incorrectly render as:
```markdown
```sql
SELECT * WHERE $__timeFilter(x)
```__
```
## Testing
- Added storybook story to reproduce the bug
- Verified fix works by disabling parseIncompleteMarkdown for completed
content
_Generated with `mux`_1 parent e28e6fe commit 3a84ef4
File tree
5 files changed
+74
-23
lines changed- src/browser
- components/Messages
- stories
5 files changed
+74
-23
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| |||
3144 | 3144 | | |
3145 | 3145 | | |
3146 | 3146 | | |
| 3147 | + | |
| 3148 | + | |
3147 | 3149 | | |
3148 | 3150 | | |
3149 | 3151 | | |
| |||
3296 | 3298 | | |
3297 | 3299 | | |
3298 | 3300 | | |
3299 | | - | |
| 3301 | + | |
3300 | 3302 | | |
3301 | 3303 | | |
3302 | 3304 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
| 98 | + | |
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
16 | 24 | | |
17 | 25 | | |
18 | 26 | | |
| |||
42 | 50 | | |
43 | 51 | | |
44 | 52 | | |
45 | | - | |
46 | | - | |
47 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
48 | 57 | | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
65 | 75 | | |
66 | 76 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
48 | 64 | | |
49 | 65 | | |
50 | 66 | | |
| |||
100 | 116 | | |
101 | 117 | | |
102 | 118 | | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
103 | 142 | | |
104 | 143 | | |
105 | 144 | | |
| |||
0 commit comments