Last active
February 9, 2025 06:43
-
-
Save dat-boris/cc36f2f92fb29d7cb0b00dcabf2d89b6 to your computer and use it in GitHub Desktop.
For Label studio rendering of MathJax
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Label Studio include for MathJax. | |
* | |
* https://docs.humansignal.com/guide/scripts | |
* | |
* Script src: https://gist.github.com/dat-boris/cc36f2f92fb29d7cb0b00dcabf2d89b6 | |
*/ | |
LSI.import('https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js'); | |
function initMathJax() { | |
const mainContentElements = document.getElementsByClassName("lsf-main-content"); | |
if (mainContentElements === undefined) { | |
throw new Error('Could not find main content element'); | |
} | |
console.log('MathJax loaded'); | |
MathJax.typesetPromise(mainContentElements).catch(err => console.log('MathJax typeset failed:', err)); | |
} | |
// give it some time for the script to import | |
initMathJax(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment