yzhang-gh / vscode-markdown

Markdown All in One
https://marketplace.visualstudio.com/items?itemName=yzhang.markdown-all-in-one
MIT License
2.93k stars 325 forks source link

\begin{align} not rendering properly in math mode #1322

Open bblfish opened 1 year ago

bblfish commented 1 year ago

What's the problem

This mathjax does not render in VSC. (see view source to see the code)

\begin{align}
level &: \text{Person} + \text{Resource} \to \Bbb{N} \\
\forall p&: \text{Person}, r: \text{Resource}.\space \text{GovTeam}(p) \land \text{level}(p) \geqslant \text{level}(r) \rightarrow \text{CanRead}(p, r)
\end{align}
Screenshot 2023-08-12 at 07 40 37

but it does show up correctly if I replace ```math with $$

Screenshot 2023-08-12 at 07 41 36

$$ \begin{align} level &: \text{Person} + \text{Resource} \to \Bbb{N} \ \forall p&: \text{Person}, r: \text{Resource}.\space \text{GovTeam}(p) \land \text{level}(p) \geqslant \text{level}(r) \rightarrow \text{CanRead}(p, r) \end{align} $$

But then it won't appear on github in a markdown file. (oddly enough it seems to work here in issues)

What's the expected result

It should render correctly in the markdown preview and in github. (I guess there is also a bug on GitHub's side)

Version used

Using 3.5.1 (2023.03.26)

yzhang-gh commented 1 year ago

Math is not a part of Markdown. It is supported in different ways in different places. For VS Code, https://code.visualstudio.com/updates/v1_58#_math-formula-rendering-in-the-markdown-preview For GitHub, https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/writing-mathematical-expressions (which supports the additional ```math way)