overleaf/services/web/frontend/js/features/mathjax/index.ts
Alf Eaton c997d1dc2b Remove MathJax v2 (#16961)
GitOrigin-RevId: 32a43361cfc883aa1a5ed85f6be5432b6e838b9d
2024-02-09 09:06:42 +00:00

17 lines
553 B
TypeScript

import { loadMathJax } from '@/features/mathjax/load-mathjax'
import { debugConsole } from '@/utils/debugging'
import getMeta from '@/utils/meta'
window.addEventListener('DOMContentLoaded', function () {
const elements = document.querySelectorAll('[data-ol-mathjax]')
if (elements.length > 0) {
loadMathJax({
enableMenu: true,
numbering: 'ams',
singleDollar: !getMeta('ol-no-single-dollar'),
useLabelIds: true,
})
.then(MathJax => MathJax.typesetPromise([...elements]))
.catch(debugConsole.error)
}
})