index.ts 553 B

1234567891011121314151617
  1. import { loadMathJax } from '@/features/mathjax/load-mathjax'
  2. import { debugConsole } from '@/utils/debugging'
  3. import getMeta from '@/utils/meta'
  4. window.addEventListener('DOMContentLoaded', function () {
  5. const elements = document.querySelectorAll('[data-ol-mathjax]')
  6. if (elements.length > 0) {
  7. loadMathJax({
  8. enableMenu: true,
  9. numbering: 'ams',
  10. singleDollar: !getMeta('ol-no-single-dollar'),
  11. useLabelIds: true,
  12. })
  13. .then(MathJax => MathJax.typesetPromise([...elements]))
  14. .catch(debugConsole.error)
  15. }
  16. })