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

Rendering issue when using equal signs on lines #9

Open
libre-man opened this issue May 14, 2019 · 1 comment
Open

Rendering issue when using equal signs on lines #9

libre-man opened this issue May 14, 2019 · 1 comment

Comments

@libre-man
Copy link

There seems to be a problem when rendering math blocks which contains equal signs (=) on a single line. It seems to interpret this as a heading (this is done by the lheading parse rule in markdown-it), screwing up the entire rendering of the output.

Example input which shows this behavior:

$\begin{pmatrix}
1 & 2 \\
3 & 4
\end{pmatrix}
\begin{pmatrix}4 & 5\end{pmatrix}
=
\begin{pmatrix}6 & 7\end{pmatrix}$

Disabling the lheading rule in block (md.block.ruler.disable(['lheading'])) fixes the issue, but this breaks al headings of this kind (as expected).

@libre-man
Copy link
Author

libre-man commented May 14, 2019

I did some further investigation into this issue. It seems like you can prevent something from being rendered as a lheading by registering as an alt for the paragraph rule. If you indicate that a block can be rendered by your rule it skips that block from being rendered as a heading. However, it seems like block rules have different parameters, so simply using the existing functions math or texMath won't work.

It seems that markdown-it-math doesn't have this issue, using the exact technique as described above. See here.

So it seems that fixing this shouldn't be too hard, however as I have zero experience writing markdown-it plugins the way to do this seems quite hard for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant