| 1 | /* |
| 2 | Currently double dollar latext with new lines causes truncation error |
| 3 | So this pseudo-remark plugin removes internal newlines with double dollar signs |
| 4 | */ |
| 5 | export function fixDoubleDollarNewLineLatex(text: string): string { |
| 6 | // Match LaTeX blocks delimited by $$ with newlines |
| 7 | const pattern = /\$\$(?:\r?\n)(.*?)(?:\r?\n)\$\$/gms; |
| 8 | |
| 9 | // Replace each matched block with $$ without newline |
| 10 | const replacedText = text.replace(pattern, "$$$$$1$$$$"); |
| 11 | |
| 12 | return replacedText; |
| 13 | } |