feat(markdown): render TikZ fenced blocks to SVG
Adds a markdown-it extractor for ```tikz blocks that emits a sanitized placeholder, plus a runTikz() that lazy-loads the obsidian-tikzjax 0.5.2 bundle from jsdelivr on first encounter, sanitizes the produced SVG with DOMPurify, and caches it in PouchDB keyed by sha256(source) so repeat views are instant and offline-capable.
This commit is contained in:
@@ -16,6 +16,7 @@ import { useLinks } from "@/hooks/useLinks.hook"
|
||||
import {
|
||||
renderCodeFile,
|
||||
runMermaid,
|
||||
runTikz,
|
||||
useShikiji
|
||||
} from "@/hooks/useMarkdown.hook"
|
||||
import { useNoteFreshness } from "@/hooks/useNoteFreshness.hook"
|
||||
@@ -160,6 +161,10 @@ watch([content, mode], () => {
|
||||
runMermaid(`.note-${sha.value} .mermaid`)
|
||||
}
|
||||
|
||||
if (rawContent.value.includes("```tikz")) {
|
||||
void runTikz(`.note-${sha.value} .tikz`)
|
||||
}
|
||||
|
||||
if (isMarkdown.value && rawContent.value.includes("```")) {
|
||||
useShikiji()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user