prosemirror-math
prosemirror-math copied to clipboard
InputRules should ignore escaped `$` symbols
trafficstars
I write many more LaTeX equations than dollar amounts, but I recognize that I am in the minority. For accessibility, prosemirror-math should have a standard (but configurable) way of escaping $ characters.
At the moment, the default inline input rule uses a negative-lookbehind regex to avoid inserting math nodes, but this has a few limitations:
- Negative lookbehinds are currently only supported in new-ish versions of Chrome and FireFox
- Sometimes, the input rules will accidentally latch on to a $ symbol in a distant node and assume the user wants to create a math block.
Solutions to consider:
- Modify ProseMirror's
InputRuleimplementation to support escape sequences before a matched string - By default,
prosemirror-mathshould assume all $'s are math-related, unless the user explicitly indicates otherwise. For example, any of the following actions should create an escaped$- use a backslash
\$to escape math - or put a space after the dollar sign
$to escape math (automaticaly remove the space)
- use a backslash
Related to #2 .