Home / GitHub Page

Replace KaTeX with MathJax

I know that KaTeX is much faster than MathJax in rendering but it supports less commands than MathJax. Is there a way I can replace KaTeX with MathJax, just for me?

Katex is added as a plugin. You could also add MathJax as a plugin, in which case people could choose between the two.
You only have to make sure that they are mutually exclusive. (I don’t want to know what would happen, if you were to enable both at the same time.)

check out the following 2 files:

ReactNativeClient/lib/MdToHtml.js
ReactNativeClient/lib/MdToHtml/rules/katex.js
1 Like

Thanks for replying. From your answer I understand that I have to recompile all the application, right? Is there a step-by-step guide how to do it? Otherwise I won’t be able to.
Thanks for help

There are build instructions there: https://github.com/laurent22/joplin/blob/master/BUILD.md

1 Like

Have you ever evaluated the possibility of using Mathjax instead of Katex. I offers more features, like equation labels and ref.

I’m against using MathJax instead of Katex. However, if MathJax is requested by a lot of people, maybe there’s a way to allow people to choose either or. (not a checkbox, but a select box)

Last time I checked, katex is faster than Mathjax, which is important for us since we render everything real time. This is important especially on mobile.

@tessus: It could be a good solution.
@laurent: I thought that the preference depends on the rendering speed.

I would also point out that there is some risk when supporting several different approaches to solving the same problem, as this may create a greater maintenance burden in the future.

Maybe it would be possible to grab the SVGs from Mathjax and cache them, only re-generating if the note changes (or ideally if the equation changes, but associating the equation with the output SVG is probably hard). Mathjax-node can ostensibly generate SVGs which could be saved and cached appropriately.

Of course that is also probably be a lot of work to implement.