mirror of
https://github.com/ankitects/anki.git
synced 2025-09-23 08:22:24 -04:00
Fix some cases where Mathjax whitespace formatting is destroyed
This commit is contained in:
parent
1185593fee
commit
8ddb0bc6ed
2 changed files with 6 additions and 1 deletions
|
@ -19,6 +19,10 @@ anki-editable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
anki-mathjax {
|
||||||
|
white-space: pre;
|
||||||
|
}
|
||||||
|
|
||||||
p {
|
p {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
|
|
|
@ -39,9 +39,10 @@ const codeMirrorOptions = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const parser = new DOMParser();
|
const parser = new DOMParser();
|
||||||
|
const parseStyle = "<style>anki-mathjax { white-space: pre; }</style>";
|
||||||
|
|
||||||
function parseHTML(html: string): string {
|
function parseHTML(html: string): string {
|
||||||
const doc = parser.parseFromString(html, "text/html");
|
const doc = parser.parseFromString(`${parseStyle}${html}`, "text/html");
|
||||||
return doc.body.innerHTML;
|
return doc.body.innerHTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue