loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix environments for KaTeX and error reporting (#22453)

In #22447 it was noticed that display environments were not working
correctly. This was due to the setting displayMode not being set.

Further it was noticed that the error was not being displayed correctly.

This PR fixes both of these issues by forcibly setting the displayMode
setting and corrects an error in displayError.

Fix #22447

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>

authored by

zeripath
Lunny Xiao
and committed by
GitHub
1e7f3c16 2782c143

+4 -2
+4 -2
web_src/js/markup/math.js
··· 1 1 function displayError(el, err) { 2 2 const target = targetElement(el); 3 - target.remove('is-loading'); 3 + target.classList.remove('is-loading'); 4 4 const errorNode = document.createElement('div'); 5 5 errorNode.setAttribute('class', 'ui message error markup-block-error mono'); 6 6 errorNode.textContent = err.str || err.message || String(err); ··· 23 23 24 24 for (const el of els) { 25 25 const source = el.textContent; 26 - const nodeName = el.classList.contains('display') ? 'p' : 'span'; 26 + const displayMode = el.classList.contains('display'); 27 + const nodeName = displayMode ? 'p' : 'span'; 27 28 28 29 try { 29 30 const tempEl = document.createElement(nodeName); 30 31 katex.render(source, tempEl, { 31 32 maxSize: 25, 32 33 maxExpand: 50, 34 + displayMode, 33 35 }); 34 36 targetElement(el).replaceWith(tempEl); 35 37 } catch (error) {