diff options
author | Jakub Jirutka <jakub@jirutka.cz> | 2018-01-24 19:02:40 +0100 |
---|---|---|
committer | Jakub Jirutka <jakub@jirutka.cz> | 2018-01-24 19:17:54 +0100 |
commit | 2efadce5e77fb0b17ea0e859ae5359cd63c7f711 (patch) | |
tree | 54a80da031edf633f449edd45514b54b3ba269be /app | |
parent | a403011e4f7adae339a3a8584e22a75f4872c3c5 (diff) | |
download | gitlab-ce-2efadce5e77fb0b17ea0e859ae5359cd63c7f711.tar.gz |
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.
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/render_math.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/assets/javascripts/render_math.js b/app/assets/javascripts/render_math.js index a759992cd54..15205d8a4e2 100644 --- a/app/assets/javascripts/render_math.js +++ b/app/assets/javascripts/render_math.js @@ -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) { |