mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 18:12:29 +08:00
feat(share): render math
This commit is contained in:
parent
0ea60fa9d7
commit
8e4bf1538d
@ -14,9 +14,19 @@ async function ensureJQuery() {
|
|||||||
(window as any).$ = $;
|
(window as any).$ = $;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function applyMath() {
|
||||||
|
const anyMathBlock = document.querySelector("#content .math-tex");
|
||||||
|
if (!anyMathBlock) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const renderMathInElement = (await import("./services/math.js")).renderMathInElement;
|
||||||
|
renderMathInElement(document.getElementById("content"));
|
||||||
|
}
|
||||||
|
|
||||||
async function formatCodeBlocks() {
|
async function formatCodeBlocks() {
|
||||||
const codeBlocks = document.querySelectorAll("#content pre");
|
const anyCodeBlock = document.querySelector("#content pre");
|
||||||
if (codeBlocks.length === 0) {
|
if (!anyCodeBlock) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await ensureJQuery();
|
await ensureJQuery();
|
||||||
@ -44,6 +54,7 @@ document.addEventListener(
|
|||||||
() => {
|
() => {
|
||||||
formatCodeBlocks();
|
formatCodeBlocks();
|
||||||
loadIcons();
|
loadIcons();
|
||||||
|
applyMath();
|
||||||
|
|
||||||
const toggleMenuButton = document.getElementById("toggleMenuButton");
|
const toggleMenuButton = document.getElementById("toggleMenuButton");
|
||||||
const layout = document.getElementById("layout");
|
const layout = document.getElementById("layout");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user