Commit e854ab2d authored by Jakub Jirutka's avatar Jakub Jirutka

Disable throwOnError in KaTeX to reveal user where is the problem

From KaTeX documentation:

> throwOnError: boolean.  If true, KaTeX will throw a ParseError when
> it encounters an unsupported command.  If false, KaTeX will render
> the unsupported command as text in the color given by errorColor.
> (default: true)

It's better to render the formula and highlight unsupported commands than
just give up and render whole formula as a code; users are confused and
don't know what's wrong.
parent a403011e
Pipeline #16578034 failed with stages
in 25 minutes and 38 seconds
......@@ -18,7 +18,7 @@ function renderWithKaTeX(elements) {
const display = $this.attr('data-math-style') === 'display';
try {
katex.render($this.text(), mathNode.get(0), { displayMode: display });
katex.render($this.text(), mathNode.get(0), { displayMode: display, throwOnError: false });
mathNode.insertAfter($this);
$this.remove();
} catch (err) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment