mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-06 06:19:52 +08:00
mathjax: change <pre> to <p> after rendering
This commit is contained in:
parent
a331eee186
commit
ada0b40d80
@ -1073,13 +1073,16 @@ var getHtmlWithInlineStyles = function(container) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Will be called after MathJax rendering finished.
|
// Will be called after MathJax rendering finished.
|
||||||
|
// Make <pre><code>math</code></pre> to <p>math</p>
|
||||||
var postProcessMathJax = function() {
|
var postProcessMathJax = function() {
|
||||||
var all = MathJax.Hub.getAllJax();
|
var all = MathJax.Hub.getAllJax();
|
||||||
for (var i = 0; i < all.length; ++i) {
|
for (var i = 0; i < all.length; ++i) {
|
||||||
var node = all[i].SourceElement().parentNode;
|
var node = all[i].SourceElement().parentNode;
|
||||||
if (node.tagName.toLowerCase() == 'code') {
|
if (node.tagName.toLowerCase() == 'code') {
|
||||||
node.classList.remove('hljs');
|
var pre = node.parentNode;
|
||||||
node.classList.add('mathjax-code');
|
var p = document.createElement('p');
|
||||||
|
p.innerHTML = node.innerHTML;
|
||||||
|
pre.parentNode.replaceChild(p, pre);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,20 +103,6 @@ pre code {
|
|||||||
white-space: pre;
|
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 {
|
aside {
|
||||||
display: block;
|
display: block;
|
||||||
float: right;
|
float: right;
|
||||||
|
@ -104,21 +104,6 @@ pre code {
|
|||||||
white-space: pre;
|
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 {
|
aside {
|
||||||
display: block;
|
display: block;
|
||||||
float: right;
|
float: right;
|
||||||
|
@ -103,20 +103,6 @@ pre code {
|
|||||||
white-space: pre;
|
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 {
|
aside {
|
||||||
display: block;
|
display: block;
|
||||||
float: right;
|
float: right;
|
||||||
|
@ -36,12 +36,14 @@ static QString marginToStrMM(qreal p_margin)
|
|||||||
|
|
||||||
void VExporter::prepareExport(const ExportOption &p_opt)
|
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,
|
m_htmlTemplate = VUtils::generateHtmlTemplate(p_opt.m_renderer,
|
||||||
p_opt.m_renderBg,
|
p_opt.m_renderBg,
|
||||||
p_opt.m_renderStyle,
|
p_opt.m_renderStyle,
|
||||||
p_opt.m_renderCodeBlockStyle,
|
p_opt.m_renderCodeBlockStyle,
|
||||||
p_opt.m_format == ExportFormat::PDF
|
isPdf);
|
||||||
|| p_opt.m_format == ExportFormat::OnePDF);
|
|
||||||
|
|
||||||
m_exportHtmlTemplate = VUtils::generateExportHtmlTemplate(p_opt.m_renderBg);
|
m_exportHtmlTemplate = VUtils::generateExportHtmlTemplate(p_opt.m_renderBg);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user