mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 09:00:12 +01:00
This commit is contained in:
parent
ea19b8d3ac
commit
cbda51a74f
1 changed files with 9 additions and 0 deletions
|
|
@ -238,6 +238,15 @@ export class Preview {
|
||||||
await window.MathJax.startup.promise;
|
await window.MathJax.startup.promise;
|
||||||
copyElement.querySelectorAll('[data-subtype="math"]').forEach(mathElement => {
|
copyElement.querySelectorAll('[data-subtype="math"]').forEach(mathElement => {
|
||||||
const node = window.MathJax.tex2svg(Lute.UnEscapeHTMLStr(mathElement.getAttribute("data-content")).trim(), {display: mathElement.tagName === "DIV"});
|
const node = window.MathJax.tex2svg(Lute.UnEscapeHTMLStr(mathElement.getAttribute("data-content")).trim(), {display: mathElement.tagName === "DIV"});
|
||||||
|
node.querySelectorAll("use").forEach(item => {
|
||||||
|
const useTarget = node.querySelector(item.getAttribute("xlink:href"));
|
||||||
|
if (useTarget) {
|
||||||
|
useTarget.setAttribute("transform", item.getAttribute("transform") || "");
|
||||||
|
item.outerHTML = useTarget.outerHTML;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
node.querySelector("mjx-assistive-mml")?.remove();
|
||||||
|
node.querySelector("defs")?.remove();
|
||||||
mathElement.innerHTML = "";
|
mathElement.innerHTML = "";
|
||||||
mathElement.append(node);
|
mathElement.append(node);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue