fix(markdown-math): prevent KaTeX parsing conflicts with jQuery selectors#268628
fix(markdown-math): prevent KaTeX parsing conflicts with jQuery selectors#268628Parasaran-Python wants to merge 1 commit intomicrosoft:mainfrom
Conversation
…tors
Adds preprocessing rule to escape dollar signs in non-mathematical contexts
like $("#id"), $("selector"), and shell command substitutions to prevent
KaTeX parse errors.
fix microsoft#268378
|
Hi @mjbvz , Issue: KaTeX was attempting to parse jQuery selectors like Root Cause: The markdown-math extension passes all Solution: Added preprocessing rule in
Could you please review this approach? Open to suggestions for improvements. |
mjbvz
left a comment
There was a problem hiding this comment.
Instead of hardcoding a list of non-math patterns, I think we should update the katex regex to be more strict. Something like:
- The opening dollar sign cannot be followed by
.. We could also potentially disallow(but there may be more cases where that's valid - The closing dollar sign cannot be followed by a
(
Please also update the test file to add tests for these cases
fix(markdown-math): prevent KaTeX parsing conflicts with jQuery selectors
Adds preprocessing rule to escape dollar signs in non-mathematical contexts
like,
$("#id"), $("selector")and shell command substitutions to preventKaTeX parse errors.
fix #268378