diff options
Diffstat (limited to 'web/react/utils')
-rw-r--r-- | web/react/utils/markdown.jsx | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/web/react/utils/markdown.jsx b/web/react/utils/markdown.jsx index 946f93078..3d967ae6d 100644 --- a/web/react/utils/markdown.jsx +++ b/web/react/utils/markdown.jsx @@ -69,6 +69,15 @@ class MattermostMarkdownRenderer extends marked.Renderer { usedLanguage = 'xml'; } + if (usedLanguage && (usedLanguage === 'tex' || usedLanguage === 'tex')) { + try { + var html = katex.renderToString(TextFormatting.sanitizeHtml(code), {throwOnError: false, displayMode: true}); + return '<div class="post-body--code tex">' + html + '</div>'; + } catch (e) { + return '<div class="post-body--code">' + TextFormatting.sanitizeHtml(code) + '</div>'; + } + } + if (!usedLanguage || highlightJs.listLanguages().indexOf(usedLanguage) < 0) { let parsed = super.code(code, usedLanguage); return '<div class="post-body--code"><code class="hljs">' + TextFormatting.sanitizeHtml($(parsed).text()) + '</code></div>'; |