diff --git a/src/resources/hoedown.js b/src/resources/hoedown.js index 8e324aed..42e4922d 100644 --- a/src/resources/hoedown.js +++ b/src/resources/hoedown.js @@ -14,7 +14,8 @@ marked.setOptions({ }); var updateHtml = function(html) { - asyncJobsCount = 0; + // There is at least one async job for MathJax. + asyncJobsCount = 1; contentDiv.innerHTML = html; @@ -84,10 +85,10 @@ var updateHtml = function(html) { MathJax.Hub.Queue(["Typeset", MathJax.Hub, contentDiv, postProcessMathJax]); } catch (err) { content.setLog("err: " + err); - finishLogics(); + finishOneAsyncJob(); } } else { - finishLogics(); + finishOneAsyncJob(); } }; diff --git a/src/resources/markdown-it.js b/src/resources/markdown-it.js index 889f3512..7082b8b6 100644 --- a/src/resources/markdown-it.js +++ b/src/resources/markdown-it.js @@ -126,7 +126,8 @@ var updateText = function(text) { text = "[TOC]\n\n" + text; } - asyncJobsCount = 0; + // There is at least one async job for MathJax. + asyncJobsCount = 1; metaDataText = null; var needToc = mdHasTocSection(text); @@ -149,10 +150,10 @@ var updateText = function(text) { MathJax.Hub.Queue(["Typeset", MathJax.Hub, contentDiv, postProcessMathJax]); } catch (err) { content.setLog("err: " + err); - finishLogics(); + finishOneAsyncJob(); } } else { - finishLogics(); + finishOneAsyncJob(); } }; diff --git a/src/resources/markdown_template.js b/src/resources/markdown_template.js index 5452f5e4..83942d69 100644 --- a/src/resources/markdown_template.js +++ b/src/resources/markdown_template.js @@ -1276,7 +1276,7 @@ var postProcessMathJax = function() { } } - finishLogics(); + finishOneAsyncJob(); }; function getNodeText(el) { diff --git a/src/resources/marked.js b/src/resources/marked.js index ab4bdeb4..bc1ffbd2 100644 --- a/src/resources/marked.js +++ b/src/resources/marked.js @@ -50,7 +50,8 @@ var updateText = function(text) { text = "[TOC]\n\n" + text; } - asyncJobsCount = 0; + // There is at least one async job for MathJax. + asyncJobsCount = 1; var needToc = mdHasTocSection(text); var html = markdownToHtml(text, needToc); @@ -71,10 +72,10 @@ var updateText = function(text) { MathJax.Hub.Queue(["Typeset", MathJax.Hub, contentDiv, postProcessMathJax]); } catch (err) { content.setLog("err: " + err); - finishLogics(); + finishOneAsyncJob(); } } else { - finishLogics(); + finishOneAsyncJob(); } }; diff --git a/src/resources/showdown.js b/src/resources/showdown.js index ed1e85ed..74a957f0 100644 --- a/src/resources/showdown.js +++ b/src/resources/showdown.js @@ -89,7 +89,8 @@ var updateText = function(text) { text = "[TOC]\n\n" + text; } - asyncJobsCount = 0; + // There is at least one async job for MathJax. + asyncJobsCount = 1; var needToc = mdHasTocSection(text); var html = markdownToHtml(text, needToc); @@ -116,10 +117,10 @@ var updateText = function(text) { MathJax.Hub.Queue(["Typeset", MathJax.Hub, contentDiv, postProcessMathJax]); } catch (err) { content.setLog("err: " + err); - finishLogics(); + finishOneAsyncJob(); } } else { - finishLogics(); + finishOneAsyncJob(); } }; diff --git a/src/utils/vutils.cpp b/src/utils/vutils.cpp index 635b85a1..5e67631f 100644 --- a/src/utils/vutils.cpp +++ b/src/utils/vutils.cpp @@ -823,6 +823,10 @@ QString VUtils::generateExportHtmlTemplate(const QString &p_renderBg, bool p_inc "SVG: {\n" "minScaleAdjust: 100,\n" "styles: {\n" +/* +FIXME: Using wkhtmltopdf, without 2em, the math formula will be very small. However, +with 2em, if there are Chinese characters in it, the font will be a mess. +*/ #if defined(Q_OS_WIN) "\".MathJax_SVG\": {\n" "\"font-size\": \"2em !important\"\n" diff --git a/src/vdocument.cpp b/src/vdocument.cpp index 3aa5f5db..99fe8611 100644 --- a/src/vdocument.cpp +++ b/src/vdocument.cpp @@ -121,7 +121,7 @@ void VDocument::setFile(const VFile *p_file) void VDocument::finishLogics() { - qDebug() << "Web side finished logics"; + qDebug() << "Web side finished logics" << this; emit logicsFinished(); }