mirror of
https://github.com/ankitects/anki.git
synced 2025-09-23 16:26:40 -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 {
|
||||
margin-top: 0;
|
||||
margin-bottom: 1rem;
|
||||
|
|
|
@ -39,9 +39,10 @@ const codeMirrorOptions = {
|
|||
};
|
||||
|
||||
const parser = new DOMParser();
|
||||
const parseStyle = "<style>anki-mathjax { white-space: pre; }</style>";
|
||||
|
||||
function parseHTML(html: string): string {
|
||||
const doc = parser.parseFromString(html, "text/html");
|
||||
const doc = parser.parseFromString(`${parseStyle}${html}`, "text/html");
|
||||
return doc.body.innerHTML;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue