Discourse Math Plugin

Summary: The math plugin uses MathJax (default) or KaTeX to render maths.

:link: GitHub: GitHub - discourse/discourse-math: Official MathJax support for Discourse

:arrow_right: Install: Follow the plugin installation guide.

Features

You can render blocks of maths by wrapping with $$

$$
\hat{H}\Psi=E\Psi
$$

You can render inline math by wrapping with a single $ like so: $E=mc^2$.

Discourse math uses a heuristic to ensure that sentences such as: “I spent 20$ and another 100$” do not get converted.

When using MathJax, you can also enable asciimath processing which uses % as a delimiter: %E=mc^2%

Configuration

:warning: This plugin is disabled by default, after installing be sure to enable it via site settings.

CHANGELOG

TODO

  • We would love to support server-side rendering, there is already an online sample.

Extras

What about the old plugin?

There is a plugin maintained by @Kasper/ @masda70 called Discourse MathJax. This plugin is a ground up re-write to support the new markdown it engine. The main differences are:

  • It is much stricter about block and inline syntax, only $ and $$ blocks are supported

  • It embeds MathJax or KaTeX renderer so you do not need to use a CDN

  • It only loads the math renderer if it detects equations on the page.

  • It surgically applies renderer as opposed to performing full page scans.

  • It is well specified using specs

54 Likes