nitlang / nit

Nit language
http://nitlanguage.org
Apache License 2.0
242 stars 67 forks source link

lib/markdown2: introduce LaTeX/Maths mode #2721

Open Morriar opened 6 years ago

Morriar commented 6 years ago

This PR is a follow up of #2720 and introduces a LaTeX/Maths mode for lib/markdown2. The goal is to handle #791 when it will be merged with the documentation tools.

The maths mode, when enabled, uses the tex2im tool to render LaTeX equations as images and includes them into the HTML output.

So one can write:

This is a LaTeX equation: $\\psi_{tot}(x,-t_0,r) = \\frac{1}{(2\\pi)^2}$.

And the output will be:

<p>This is a LaTeX equation: <img alt="\\psi_{tot}(x,-t_0,r) = \\frac{1}{(2\\pi)^2}" src="b123b75db5eb96ac4496d017a18633b5.png" /> baz</p>

Where the image will be: b123b75db5eb96ac4496d017a18633b5

To work this PR requires tex2im to be installed and added to the path.