Skip to content

Commit c42398f

Browse files
committed
Fix nullpointer in KaTeX double-rendering
As described in #12259, Tippy.js popups on crossrefs failed if the previewed entity contained KaTeX math elements. This seems to be due to double rendering where the `data` attribute is unset on the second pass. Just skipping the invocation of the KaTeX renderer in these instances solves the issue.
1 parent 40e447a commit c42398f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/resources/formats/html/pandoc/template.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
var macros = [];
3232
for (var i = 0; i < mathElements.length; i++) {
3333
var texText = mathElements[i].firstChild;
34-
if (mathElements[i].tagName == "SPAN") {
34+
if (mathElements[i].tagName == "SPAN" && texText && texText.data) {
3535
window.katex.render(texText.data, mathElements[i], {
3636
displayMode: mathElements[i].classList.contains('display'),
3737
throwOnError: false,

0 commit comments

Comments
 (0)