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

GitHub now supports LaTeX in three-tick code block syntax ```math #8633

Closed
fasiha opened this issue Feb 18, 2023 · 4 comments
Closed

GitHub now supports LaTeX in three-tick code block syntax ```math #8633

fasiha opened this issue Feb 18, 2023 · 4 comments

Comments

@fasiha
Copy link

fasiha commented Feb 18, 2023

GitHub recently(?) began rendering content inside ```math code blocks as LaTeX equations, that is,

```math
x = 1
``\

get rendered the same way as

$$x = 1$$

Example:

$$x = 1$$

However it appears that Pandoc's gfm doesn't handle this. I'm trying pandoc -f gfm+tex_math_dollars --mathjax -s -t html5 -i issue.md -o issue.html and the code block syntax is rendered in HTML as a plain code block.

I am experimenting with ```math syntax because GitHub won't typeset LaTeX inside double-dollar notation if it spans multiple lines. For example, below is GitHub's rendering of the following:

$$
  x =
  2
$$
vs
```math
  x =
  3
``\

$$
x =
2
$$
vs

$$x = 3$$

As you can see, it butchers the double-dollar multi-line equation but ```math is fine.

I know the risks of breaking with established patterns (like double-dollar signs, beautifully supported by LaTeX and Pandoc and many other tools for decades now) for syntax unilaterally introduced by Microsoft, which is why I am only tentatively experimenting with it.

A thousand apologies if this has been discussed before but I couldn't find it.

@fasiha fasiha changed the title GitHub now supports LaTeX in three-tick code block syntax GitHub now supports LaTeX in three-tick code block syntax ```math Feb 18, 2023
@jgm
Copy link
Owner

jgm commented Feb 19, 2023

It's unfortunate that their implementation of $$ math has this limitation.

We can consider adding this, but in the mean time you can easy handle this with a short Lua filter that matches a CodeBlock with class math and replaces it with Para [Math DisplayMath ((contents))].

@jgm
Copy link
Owner

jgm commented Oct 22, 2023

Folding this into #9121 which also has the new inline math format.

@jgm jgm closed this as completed Oct 22, 2023
@jgm
Copy link
Owner

jgm commented Oct 24, 2023

$$ x = 2 $$

vs

$$x = 3$$

@jgm
Copy link
Owner

jgm commented Oct 24, 2023

Interestingly, adding a newline after the closing $$ makes it work.

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

No branches or pull requests

2 participants