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

add $ and $$ parsing for MathJax formula #7

Merged
merged 1 commit into from Mar 12, 2019

Conversation

Projects
None yet
2 participants
@yujincheng08
Copy link
Contributor

yujincheng08 commented Mar 3, 2019

For mathjax formulation plugin, it uses $ as marker. The markdown parse engine should not parse text between two $'s so as to be compatible with it.

@yujincheng08

This comment has been minimized.

Copy link
Contributor Author

yujincheng08 commented Mar 3, 2019

Oh! I should put them into the extension.php. Let me modify it...

@yujincheng08

This comment has been minimized.

Copy link
Contributor Author

yujincheng08 commented Mar 4, 2019

Updated to extension.php.

@mrgeneralgoo

This comment has been minimized.

Copy link
Owner

mrgeneralgoo commented Mar 7, 2019

Can you give me a link to mathjax formulation plugin?

thx

@yujincheng08

This comment has been minimized.

Copy link
Contributor Author

yujincheng08 commented Mar 7, 2019

@mrgeneralgoo

This comment has been minimized.

Copy link
Owner

mrgeneralgoo commented Mar 8, 2019

I tested the current version (1.1.0) , it work well.

You may need to focus on the escape some special symbols, such as slashes etc.

Any questions, welcome feedback.

Happy coding.

thx.

mathjax

source below

[TOC]

Test 1

$ E=MC $ => $ E=MC $
$x^{y^z}=(1+{\rm e}^x)^{-2xy^w}$ => $x^{y^z}=(1+{\rm e}^x)^{-2xy^w}$
$f(x,y,z) = 3y^2z \left( 3+\frac{7x+5}{1+y^2} \right)$ => $f(x,y,z) = 3y^2z \left( 3+\frac{7x+5}{1+y^2} \right)$

Test 2

$$f(x)=
\\begin{cases}
0& \\text{x=0}\\\\
1& \\text{x!=0}
\\end{cases}$$

$$f(x)=
\begin{cases}
0& \text{x=0}\\
1& \text{x!=0}
\end{cases}​$$

$$ f(x)=\\left\\{
\\begin{aligned}
x & = & \\cos(t) \\\\
y & = & \\sin(t) \\\\
z & = & \\frac xy
\\end{aligned}
\\right.
$$

$$ f(x)=\left\{
\begin{aligned}
x & = & \cos(t) \\
y & = & \sin(t) \\
z & = & \frac xy
\end{aligned}
\right.
$$

environment

<script type="text/x-mathjax-config">MathJax.Hub.Config({tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}});</script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
@mrgeneralgoo

This comment has been minimized.

Copy link
Owner

mrgeneralgoo commented Mar 8, 2019

@yujincheng08
Maybe I misunderstood what your mean. Let me study it again.

sorry.

@yujincheng08

This comment has been minimized.

Copy link
Contributor Author

yujincheng08 commented Mar 8, 2019

@mrgeneralgoo The main purpose of this PR is to avoid converting text inside two $'s and between two _.
For instance, $x_1 = x_2$.
Without my PR, the parser will convert this line into:

$x<i>1=x</i>2$

In this case, mathjax cannot render it into mathematics formula.

@mrgeneralgoo mrgeneralgoo merged commit 477dc47 into mrgeneralgoo:master Mar 12, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.