Skip to content

Instantly share code, notes, and snippets.

@J3698
Created September 9, 2021 19:32
Show Gist options
  • Save J3698/445ecaedd0535ef25b47f6e8f503e40c to your computer and use it in GitHub Desktop.
Save J3698/445ecaedd0535ef25b47f6e8f503e40c to your computer and use it in GitHub Desktop.
Typeset all over again
function addReTypesetHandler() {
var script = document.createElement("script");
script.innerHTML = `
last = "1";
setInterval(function() {
var tag = document.getElementsByClassName("invisible")[0];
if (tag.innerHTML != last) {
MathJax.Hub.Queue(["Typeset", MathJax.Hub]);
last = tag.innerHTML;
}
}, 50);
`
document.body.appendChild(script);
var updateTag = document.createElement("span");
updateTag.classList.add("invisible");
document.body.appendChild(updateTag);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment