From ada0b40d80711f54f22d3cda290c12d40a4f60a0 Mon Sep 17 00:00:00 2001 From: Le Tan Date: Fri, 2 Mar 2018 22:37:14 +0800 Subject: [PATCH] mathjax: change
 to 

after rendering --- src/resources/markdown_template.js | 7 +++++-- src/resources/themes/v_moonlight/v_moonlight.css | 14 -------------- src/resources/themes/v_pure/v_pure.css | 15 --------------- src/resources/themes/v_white/v_white.css | 14 -------------- src/vexporter.cpp | 6 ++++-- 5 files changed, 9 insertions(+), 47 deletions(-) diff --git a/src/resources/markdown_template.js b/src/resources/markdown_template.js index 93f6a0ad..0f560bcd 100644 --- a/src/resources/markdown_template.js +++ b/src/resources/markdown_template.js @@ -1073,13 +1073,16 @@ var getHtmlWithInlineStyles = function(container) { }; // Will be called after MathJax rendering finished. +// Make

math
to

math

var postProcessMathJax = function() { var all = MathJax.Hub.getAllJax(); for (var i = 0; i < all.length; ++i) { var node = all[i].SourceElement().parentNode; if (node.tagName.toLowerCase() == 'code') { - node.classList.remove('hljs'); - node.classList.add('mathjax-code'); + var pre = node.parentNode; + var p = document.createElement('p'); + p.innerHTML = node.innerHTML; + pre.parentNode.replaceChild(p, pre); } } diff --git a/src/resources/themes/v_moonlight/v_moonlight.css b/src/resources/themes/v_moonlight/v_moonlight.css index e30d7f0b..0872cc17 100644 --- a/src/resources/themes/v_moonlight/v_moonlight.css +++ b/src/resources/themes/v_moonlight/v_moonlight.css @@ -103,20 +103,6 @@ pre code { white-space: pre; } -code.mathjax-code { - display: block; - overflow-x: inherit; - margin: 0; - padding: 0; - color: inherit; - background: inherit; - font-style: normal; - font-weight: normal; - font-size: 16px; - font-family: inherit; - line-height: 24px; -} - aside { display: block; float: right; diff --git a/src/resources/themes/v_pure/v_pure.css b/src/resources/themes/v_pure/v_pure.css index 653134aa..465eaa2c 100644 --- a/src/resources/themes/v_pure/v_pure.css +++ b/src/resources/themes/v_pure/v_pure.css @@ -104,21 +104,6 @@ pre code { white-space: pre; } -/* Should reference the style of P. */ -code.mathjax-code { - display: block; - overflow-x: inherit; - margin: 0; - padding: 0; - color: inherit; - background: inherit; - font-style: normal; - font-weight: normal; - font-size: 16px; - font-family: inherit; - line-height: 24px; -} - aside { display: block; float: right; diff --git a/src/resources/themes/v_white/v_white.css b/src/resources/themes/v_white/v_white.css index 70baf3c1..6cecda75 100644 --- a/src/resources/themes/v_white/v_white.css +++ b/src/resources/themes/v_white/v_white.css @@ -103,20 +103,6 @@ pre code { white-space: pre; } -code.mathjax-code { - display: block; - overflow-x: inherit; - margin: 0; - padding: 0; - color: inherit; - background: inherit; - font-style: normal; - font-weight: normal; - font-size: 16px; - font-family: inherit; - line-height: 24px; -} - aside { display: block; float: right; diff --git a/src/vexporter.cpp b/src/vexporter.cpp index 0bcb4004..4cb7b543 100644 --- a/src/vexporter.cpp +++ b/src/vexporter.cpp @@ -36,12 +36,14 @@ static QString marginToStrMM(qreal p_margin) void VExporter::prepareExport(const ExportOption &p_opt) { + bool isPdf = p_opt.m_format == ExportFormat::PDF + || p_opt.m_format == ExportFormat::OnePDF; + m_htmlTemplate = VUtils::generateHtmlTemplate(p_opt.m_renderer, p_opt.m_renderBg, p_opt.m_renderStyle, p_opt.m_renderCodeBlockStyle, - p_opt.m_format == ExportFormat::PDF - || p_opt.m_format == ExportFormat::OnePDF); + isPdf); m_exportHtmlTemplate = VUtils::generateExportHtmlTemplate(p_opt.m_renderBg);