Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InputRules should ignore escaped $ symbols #10

Open
benrbray opened this issue Mar 27, 2021 · 1 comment
Open

InputRules should ignore escaped $ symbols #10

benrbray opened this issue Mar 27, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@benrbray
Copy link
Owner

benrbray commented Mar 27, 2021

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 InputRule implementation to support escape sequences before a matched string
  • By default, prosemirror-math should 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)
@benrbray benrbray added the bug Something isn't working label Mar 27, 2021
@benrbray benrbray changed the title Allow Escaped InputRules should ignore escaped $ symbols Mar 27, 2021
@benrbray
Copy link
Owner Author

Related to #2 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant