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:
@@ -188,6 +188,36 @@ pre.mermaid {
|
||||
background-color: var(--color-base-content);
|
||||
}
|
||||
|
||||
pre.tikz {
|
||||
display: block;
|
||||
overflow-x: auto;
|
||||
text-align: center;
|
||||
padding: 0.5rem;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
pre.tikz svg {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.tikz-loading {
|
||||
opacity: 0.6;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.tikz-error {
|
||||
border-left: 3px solid var(--color-error);
|
||||
padding: 0.5rem 0.75rem;
|
||||
background: color-mix(in srgb, var(--color-error) 10%, transparent);
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.tikz-error pre {
|
||||
white-space: pre-wrap;
|
||||
font-size: 0.85em;
|
||||
}
|
||||
|
||||
.markdown-alert {
|
||||
padding: 1rem;
|
||||
background-color: #ecf0f1;
|
||||
|
||||
Reference in New Issue
Block a user