mathjax: change <pre> to <p> after rendering

This commit is contained in:
Le Tan 2018-03-02 22:37:14 +08:00
parent a331eee186
commit ada0b40d80
5 changed files with 9 additions and 47 deletions

View File

@ -1073,13 +1073,16 @@ var getHtmlWithInlineStyles = function(container) {
};
// Will be called after MathJax rendering finished.
// Make <pre><code>math</code></pre> to <p>math</p>
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);
}
}

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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);