mirror of
https://github.com/zadam/trilium.git
synced 2025-10-29 10:39:00 +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() {
|
const mermaid = (await import("mermaid")).default;
|
||||||
for (const codeBlock of document.querySelectorAll("#content pre code.language-mermaid")) {
|
|
||||||
|
for (const codeBlock of mermaidEls) {
|
||||||
const parentPre = codeBlock.parentElement;
|
const parentPre = codeBlock.parentElement;
|
||||||
if (!parentPre) {
|
if (!parentPre) {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user