mirror of
https://github.com/zadam/trilium.git
synced 2025-10-28 18:18:55 +01:00
chore(share): load Mermaid only when necessary
This commit is contained in:
parent
4ef7667484
commit
6ae67c410c
@ -1,7 +1,12 @@
|
||||
import mermaid from "mermaid";
|
||||
export default async function setupMermaid() {
|
||||
const mermaidEls = document.querySelectorAll("#content pre code.language-mermaid");
|
||||
if (mermaidEls.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
export default function setupMermaid() {
|
||||
for (const codeBlock of document.querySelectorAll("#content pre code.language-mermaid")) {
|
||||
const mermaid = (await import("mermaid")).default;
|
||||
|
||||
for (const codeBlock of mermaidEls) {
|
||||
const parentPre = codeBlock.parentElement;
|
||||
if (!parentPre) {
|
||||
continue;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user