statiqdev / Statiq.Web

Statiq Web is a flexible static site generator written in .NET.

Home Page:https://statiq.dev/web

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mathematics from markdown broken in some cases

ror3d opened this issue · comments

commented

I have the following code

$$ M = \begin{bmatrix} a & b & c & d\\ e & f & g & h\\ i & j & k & l\\ m & n & o & p \end{bmatrix} $$

this works fine, it renders as a ...

But when I try to format it in a way that's a bit more clear to edit in the markdown, such as

$$
M = \begin{bmatrix}
a & b & c & d\\
e & f & g & h\\
i & j & k & l\\
m & n & o & p
\end{bmatrix}
$$

This breaks down, because it creates a

tag with bmatrix attribute <p bmatrix> around all of this, since it considers the {bmatrix} an attribute to add to the tag.

This might be an issue with the markdig templating implementation, but I don't know exactly how the interaction is implemented so I'm creating the issue here first. According to their documentation on the topic, my use case should be working https://github.com/xoofx/markdig/blob/master/src/Markdig.Tests/Specs/MathSpecs.md#math-block

commented

Actually, forget that, I have been testing further and it seems to work now. Apparently it's a bit finnicky, My code initially looked like

$$ M = \begin{bmatrix}
a & b & c & d\\
e & f & g & h\\
i & j & k & l\\
m & n & o & p
\end{bmatrix}
$$

And that it didn't like. The example I added in the original issue actually does work, but on one of my attempts it didn't, maybe just a weird cache issue or something like that.

Great, glad you got it figured out! Yeah, Statiq doesn't do a lot of processing of the Markdown content before it gets fed to Markdig. In fact, the integration is tight enough that you can turn Markdig extensions on and off. In this case, it would almost certainly be an issue upstream if there were still a problem - but I don't mind looking into it first if a Markdown issue like this comes up again.