The PR fixes a bug where Katex would error out if the content in an inline math block would have length less than 3.
For example:
Consider the following markdown snippet,
This letter is typeset inline $x$. This is another inline math block $Quadratic \; Formula$.
This causes this error upon rendering:
KaTeX parse error: Can't use function '$' in math mode at position 2: x$̲. This is anoth…
Because the original regex /\s\$(\S.+?\S)\$/ assumes that the content is non-empty, it is prefixed and suffixed by a necessary non-whitespace character.
The new regex /\s\$((?=\S).*?(?=\S))\$/ takes care of this error by having positive lookup at the start and the end of the content.
The PR fixes a bug where Katex would error out if the content in an inline math block would have length less than 3.
For example: Consider the following markdown snippet,
This causes this error upon rendering:
KaTeX parse error: Can't use function '$' in math mode at position 2: x$̲. This is anoth…
Because the original regex
/\s\$(\S.+?\S)\$/
assumes that the content is non-empty, it is prefixed and suffixed by a necessary non-whitespace character.The new regex
/\s\$((?=\S).*?(?=\S))\$/
takes care of this error by having positive lookup at the start and the end of the content.