fix: handle escaped curly braces in LaTeX formulas (#608) (#660)

- Add unescape for \{ and \} characters in unescapeMarkdownSpecialChars()
- These are commonly used in LaTeX commands like \mathcal{F}
- Add test cases for Fourier transform notation and mixed escape scenarios
- All 118 tests pass including 4 new edge case tests for issue #608
This commit is contained in:
Willem Jiang
2025-10-26 10:15:35 +08:00
committed by GitHub
parent bcc403ecd3
commit 6ded818f62
2 changed files with 32 additions and 0 deletions

View File

@@ -35,6 +35,8 @@ function unescapeMarkdownSpecialChars(text: string): string {
.replace(/\\_/g, '_') // \_ → _
.replace(/\\\[/g, '[') // \[ → [
.replace(/\\\]/g, ']') // \] → ]
.replace(/\\\{/g, '{') // \{ → {
.replace(/\\\}/g, '}') // \} → }
.replace(/\\\\/g, '\\'); // \\ → \
}