Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/yellow-bags-pump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@tiptap/extension-mathematics': minor
---

Prevent inline math input rule from replacing previous character

- Changed input rule to utilize negative lookbehind rather than regular character match to ensure preceding character is not consumed in final match. This ensures the range's `from` position is correctly at the start o the double `$` signs.
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ export const InlineMath = Node.create<InlineMathOptions>({
addInputRules() {
return [
new InputRule({
find: /(^|[^$])(\$\$([^$\n]+?)\$\$)(?!\$)/,
find: /(?<!$)(\$\$([^$\n]+?)\$\$)(?!\$)/,
handler: ({ state, range, match }) => {
const latex = match[3]
const { tr } = state
Expand Down
Loading