diff --git a/src/config.xml b/src/config.xml index 080230c66d4..56a0b56e91a 100644 --- a/src/config.xml +++ b/src/config.xml @@ -2475,20 +2475,33 @@ The \c DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. ]]> + - @@ -2506,10 +2523,15 @@ The \c DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. diff --git a/src/configimpl.l b/src/configimpl.l index cae157bcbad..d557d4363e3 100644 --- a/src/configimpl.l +++ b/src/configimpl.l @@ -1548,6 +1548,23 @@ void Config::checkAndCorrect() // Test to see if MathJax code file is valid if (Config_getBool(USE_MATHJAX)) { + QCString mathJaxFormat = Config_getEnum(MATHJAX_FORMAT); + QCString mathjaxVersion = Config_getEnum(MATHJAX_VERSION); + if (!mathJaxFormat.isEmpty()) + { + if (mathjaxVersion == "MathJax_2") + { + if (mathJaxFormat=="chtml") Config_updateEnum(MATHJAX_FORMAT,"HTML-CSS"); + } + else + { + if (mathJaxFormat=="HTML-CSS" || mathJaxFormat=="NativeMML") + { + Config_updateEnum(MATHJAX_FORMAT,"chtml"); + } + } + } + QCString mathJaxCodefile = Config_getString(MATHJAX_CODEFILE); if (!mathJaxCodefile.isEmpty()) { @@ -1559,7 +1576,19 @@ void Config::checkAndCorrect() } } QCString path = Config_getString(MATHJAX_RELPATH); - if (!path.isEmpty() && path.at(path.length()-1)!='/') + if (path.isEmpty()) + { + if (mathjaxVersion == "MathJax_2") + { + path = "https://cdn.jsdelivr.net/npm/mathjax@2"; + } + else + { + path = "https://cdn.jsdelivr.net/npm/mathjax@3"; + } + } + + if (path.at(path.length()-1)!='/') { path+="/"; } @@ -1974,15 +2003,6 @@ void Config::checkAndCorrect() } Config_updateInt(HTML_COLORSTYLE_GAMMA,gamma); - //------------------------ - QCString mathJaxFormat = Config_getEnum(MATHJAX_FORMAT); - if (!mathJaxFormat.isEmpty() && mathJaxFormat!="HTML-CSS" && - mathJaxFormat!="NativeMML" && mathJaxFormat!="SVG") - { - err("Unsupported value for MATHJAX_FORMAT: Should be one of HTML-CSS, NativeMML, or SVG\n"); - Config_updateEnum(MATHJAX_FORMAT,"HTML-CSS"); - } - //------------------------ // add default words if needed const StringVector &annotationFromBrief = Config_getList(ABBREVIATE_BRIEF); diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp index fc00b17b199..3340ad9ca9a 100644 --- a/src/htmlgen.cpp +++ b/src/htmlgen.cpp @@ -437,44 +437,109 @@ static QCString substituteHtmlKeywords(const QCString &str, if (mathJax) { + QCString mathJaxVersion = Config_getEnum(MATHJAX_VERSION); QCString path = Config_getString(MATHJAX_RELPATH); if (path.isEmpty() || path.left(2)=="..") // relative path { path.prepend(relPath); } - mathJaxJs = "\n"; + + if (!g_latex_macro.isEmpty()) + { + mathJaxJs += "\n"; + } + + // MATHJAX_CODEFILE + if (!g_mathjax_code.isEmpty()) + { + mathJaxJs += "\n"; + } + + + mathJaxJs += "\n" ; + } + else if (mathJaxFormat == "SVG") + { + mathJaxJs += "es5/tex-svg.js\">\n" ; + } } - mathJaxJs += "\n"; - if (!g_latex_macro.isEmpty()) + else { - mathJaxJs += "\n"; + mathJaxJs = "\n"; + if (!g_latex_macro.isEmpty()) + { + mathJaxJs += "\n"; + } + mathJaxJs += "\n"; } - mathJaxJs += "\n"; } // first substitute generic keywords