mirror of
https://github.com/alexadam/save-as-ebook.git
synced 2025-09-10 09:24:49 +00:00
better support for MathJax/MathML
This commit is contained in:
parent
523c314374
commit
947c5613f7
1 changed files with 7 additions and 4 deletions
|
@ -61,13 +61,16 @@ function formatPreCodeElements($jQueryElement) {
|
|||
});
|
||||
}
|
||||
|
||||
function preProcess($htmlObject) {
|
||||
$htmlObject.find('script[type="math/mml"]').each(function (i, el) {
|
||||
$(el).replaceWith('<span>' + el.innerHTML + '</span>');
|
||||
function extractMathMl($htmlObject) {
|
||||
$htmlObject.find('span[id^="MathJax-Element-"]').each(function (i, el) {
|
||||
$(el).replaceWith('<span>' + el.getAttribute('data-mathml') + '</span>');
|
||||
});
|
||||
}
|
||||
|
||||
function preProcess($htmlObject) {
|
||||
extractMathMl($htmlObject);
|
||||
$htmlObject.find('script, style, svg, canvas, noscript, iframe').remove();
|
||||
$htmlObject.find('*:empty').not('img').remove();
|
||||
$htmlObject.find('*[class^="mjx-chtml"]').remove(); // MathJax formatting
|
||||
formatPreCodeElements($htmlObject);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue