Repository navigation
Commit 566e173
committed
fix(math): reject currency patterns and cross-line matches in inline math
Fix three bugs in INLINE_MATH_PATTERN that cause false-positive inline
math detection on currency values like $51,300:
1. Add (?!\$) after opening $ to reject $$ block delimiter starts
2. Change [^$\\] to [^$\\\n] to disallow newlines (single-line only)
3. Add (?!\d) after closing $ to reject currency (GFM-compatible)
4. Remove broken (?!\s) lookahead before closing $ (was always a no-op
since it checked the $ delimiter itself, not preceding content)
The (?!\s) at the opening is preserved — inline math still requires
non-whitespace after the opening $.
Reported-by: geopanther (geopanther/mdfluence#70)1 parent f21a29b commit 566e173
2 files changed
Lines changed: 37 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
0 commit comments