-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
feat(auto-render): add option to ignore escaped special characters outside of LaTeX math mode (#437) #3798
base: main
Are you sure you want to change the base?
Conversation
I disagree with this premise (assuming I understand it correctly):
In fact, $$
\{x \mid x \text{ is divisible by $y$ or $z$}\}
$$ So you can't just escape them.
|
Thanks for your reply. There was an issue with the formatting in my previous answer, where the backslashes had been removed. Moreover, the PR I propose does not bring any breaking change, and solve this issue mentioned in #3775:
|
Ahh, now I understand. Thanks for explaining! That does sound useful. |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #3798 +/- ##
==========================================
+ Coverage 92.99% 93.00% +0.01%
==========================================
Files 91 91
Lines 6779 6803 +24
Branches 1576 1586 +10
==========================================
+ Hits 6304 6327 +23
- Misses 437 438 +1
Partials 38 38
Continue to review full report in Codecov by Sentry.
|
788923a
to
de8d0e1
Compare
…tside of LaTeX math mode (KaTeX#437)
This PR is ready for final review, thanks in advance. |
Thanks for making this! Would also be interested in helping get this over the finish line if any reviewers are willing to take a look. |
feat(auto-render): add option to ignore escaped special characters outside of LaTeX math mode (#437)
What is the previous behavior before this PR?
Some escapable characters were not properly escaped in math LaTeX mode in auto-render.
For instance, in the following LaTeX string:
$$
\$100 + \$100 = \$200
$$
the "\$" should be parsed as "$" symbols.
What is the new behavior after this PR?
This PR introduces a new option to auto-render:
supportEscapedSpecialCharsInText
:boolean
(default:false
). Iftrue
,\$
are ignored outside of LaTeX math expressions.For example:
Please enjoy this 2\$ coffee and I'll explain why $e = mc^2$.
When set to
true
, it fixes the issue and properly escape those LaTeX escapable characters.When set to
false
, the existing behavior is kept to avoid breaking existing uses.The tests have been updated accordingly, and some tests added to show those fixed behaviors.