Skip to content

Commit 82b2a5c

Browse files
dschojvns
authored andcommitted
graphviz: allow overriding the engine
This can be done like so: {{< graphviz engine="neato" >}} Signed-off-by: Johannes Schindelin <[email protected]>
1 parent d8b2513 commit 82b2a5c

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

layouts/_default/baseof.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,8 @@ <h1 data-pagefind-meta="title">About{{ if (isset .Params "subtitle") }} - {{ .Pa
204204
let vizInstance
205205
[...document.querySelectorAll("pre[class=graphviz]")].forEach(async (x) => {
206206
if (!vizInstance) vizInstance = await Viz.instance()
207-
const svg = vizInstance.renderSVGElement(x.innerText)
207+
const engine = x.getAttribute("engine") || undefined
208+
const svg = vizInstance.renderSVGElement(x.innerText, { engine })
208209
x.parentNode.insertBefore(svg, x);
209210
x.style.display = 'none'
210211
});

layouts/shortcodes/graphviz.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<pre class="graphviz">
1+
<pre class="graphviz"{{ if (ne "" (.Get "engine")) }} engine="{{(.Get "engine")}}"{{ end }}>
22
{{ .Inner | htmlEscape | safeHTML }}
33
</pre>
44
{{ .Page.Store.Set "hasGraphviz" true }}

0 commit comments

Comments
 (0)