nodebb-plugin-katex

Use Katex math parser inside NodeBB

Usage no npm install needed!

<script type="module">
  import nodebbPluginKatex from 'https://cdn.skypack.dev/nodebb-plugin-katex';
</script>

README

npm version Dependency Status

NodeBB Katex Parser

This NodeBB plugin is a parser that allows users to write posts containing maths formulas in tex format using Katex.

To customize options for the parser, please consult the "Katex" page in the administration panel, under the "Plugins" heading.

Installation

npm install nodebb-plugin-katex

Usage

Just wrap your tex code inside your posts using these delimiters:

Brackets delimiters

  • \\(This is \tex code\\) for inline display.
  • \\[This is \tex code\\] for block display.

Dollars delimiters

  • $This is \tex code$ for inline display(optional: disabled by default, must be set in the admin control panel).
  • $This is \tex code$ for block display.

Features

  • Use katex in the server-side to display tex code inside posts, summaries and composer preview.
  • Adds a $ button to the composer toolbar to facilitate usage.

nodebb-plugin-katex.png

Compatibility

This plugin is compatible with nodebb v0.7.x and above and with the nodebb-plugin-markdown plugin.

When used in conjunction with the nodebb-plugin-markdown, you have to load katex plugin after markdown plugin to enable usage of all buttons of the composer.

Debugging

Katex parsing errors are logged using winston the default logger in nodebb at level verbose, you need to run nodebb dev to see these logs.

Credits

The code is greatly inspired by those others repositories: