Commit c21129b
xlx1212
fix(markdown-editor): preserve LaTeX backslashes for KaTeX rendering
analyzeMarkdownEditability canonicalizes markdown through a tiptap
round-trip that calls escapeMarkdownPlainText, which doubles every
backslash. This turns LaTeX commands like \int into \\int, \frac into
\\frac, etc. KaTeX interprets \\ as a line break, breaking math
rendering in the file viewer preview.
Fix: use raw markdown content instead of canonicalMarkdown in both
content normalization paths (toNormalizedMarkdown and initialContent
loading). The tiptap editor normalizes content internally, so the
canonical form is not needed for display.
Add a root-cause test in tiptapMarkdown.test.ts documenting that
canonicalMarkdown doubles backslashes in LaTeX math content.
Closes #19521 parent 6f89691 commit c21129b
2 files changed
Lines changed: 21 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
146 | | - | |
147 | | - | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
148 | 150 | | |
149 | 151 | | |
150 | 152 | | |
| |||
262 | 264 | | |
263 | 265 | | |
264 | 266 | | |
265 | | - | |
266 | | - | |
267 | | - | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
268 | 270 | | |
269 | 271 | | |
270 | 272 | | |
| |||
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
334 | 334 | | |
335 | 335 | | |
336 | 336 | | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
337 | 351 | | |
0 commit comments