markdownload icon indicating copy to clipboard operation
markdownload copied to clipboard

Uncaught ReferenceError: MathJax is not defined

Open valenting opened this issue 6 months ago • 1 comments

  1. Go to https://www.bauhaus.se/sticksag-bosch-universal-saw-18v-100-utan-batteri
  2. Right click -> MarkDownload -> Copy tab URL as markdown link

Observe that:

  • tab URL is actually copied
  • Page gets messed up when you perform this
  • DevTools console shows:
Uncaught ReferenceError: MathJax is not defined
    addLatexToMathJax3 moz-extension://27f8dedc-9407-414d-89c1-3d31b02448e4/contentScript/pageContext.js:3
    <anonymous> moz-extension://27f8dedc-9407-414d-89c1-3d31b02448e4/contentScript/pageContext.js:11
[pageContext.js:3:9](moz-extension://27f8dedc-9407-414d-89c1-3d31b02448e4/contentScript/pageContext.js)

The code at fault seems to be:

function addLatexToMathJax3()
{
    if (!MathJax?.startup?.document?.math)
        return

    for (math of MathJax.startup.document.math)
    {
        math.typesetRoot.setAttribute("markdownload-latex", math.math)
    }
}
addLatexToMathJax3()

Using MarkDownload Version 3.4.0 on Firefox 140.

valenting avatar Jun 21 '25 20:06 valenting

Including the script from here solves it:

https://github.com/mathjax/MathJax

Pranoy1c avatar Jun 22 '25 16:06 Pranoy1c