Fossil Forum

Adding MathJax to wiki
Login

Adding MathJax to wiki

Adding MathJax to wiki

(1) By anonymous on 2023-02-01 14:11:52 [source]

It's trivial to add MathJax support to wiki pages. Just edit the skin to insert the Javascript from their website.

The problem is that this more or less doesn't work, because everything inside the equations will be parsed and converted to html, and then you end up with html tags destroying your equations. I came up with a different solution. Enclose the equation inside backticks, like this:

`$y_{t} = x_{t}$`

and add this Javascript before loading MathJax:

document.getElementsByClassName("markdown")[0].innerHTML = document.getElementsByClassName("markdown")[0].innerHTML.toString().replaceAll("<code>$", "$").replaceAll("$</code>", "$")

That works, but it requires a slightly non-standard syntax. Is there another way to approach this, or perhaps to use a CGI extension to do the conversion from markdown to html? More generally, I couldn't find anything about math support in the documentation. This is critical for those of us working on numerical software. Fossil is the perfect tool for us but it is impossible to properly describe things without using equations.

(2) By Warren Young (wyoung) on 2023-02-01 14:47:26 in reply to 1 [link] [source]

How do Jupyter notebooks handle this?

(3) By anonymous on 2023-02-01 19:24:24 in reply to 2 [link] [source]

I haven't done too much with Jupyter notebooks. The syntax is $ for inline equations and \begin{equation} for displayed. The former is common in markdown, but the latter is embedded latex, which probably wouldn't work for Fossil. Pandoc uses $ for inline and $$ for displayed.