diff --git a/content/posts/2020-07-14-hello-world/index.md b/content/posts/2020-07-14-hello-world/index.md index 805eb07..9eb06e8 100644 --- a/content/posts/2020-07-14-hello-world/index.md +++ b/content/posts/2020-07-14-hello-world/index.md @@ -8,6 +8,7 @@ tags: categories: favorite: false tikz: true +graphviz: true --- ## Test post please ignore @@ -40,6 +41,16 @@ echo hello world | cut -d' ' -f 1 \end{tikzpicture} {{% /tikz %}} +### Graphviz support + +{{% graphviz %}} + graph { + a -- b + b -- c + c -- a + } +{{% /graphviz %}} + ### Spoilers {{% spoiler "Don't open me" %}} diff --git a/layouts/partials/head-extra.html b/layouts/partials/head-extra.html index 1e65c9f..f0a049d 100644 --- a/layouts/partials/head-extra.html +++ b/layouts/partials/head-extra.html @@ -3,6 +3,23 @@ {{ end }} + +{{ if (.Params.graphviz) }} + + +{{ end }} {{ with .OutputFormats.Get "atom" -}} {{ printf `` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }} {{ end -}} diff --git a/layouts/shortcodes/graphviz.html b/layouts/shortcodes/graphviz.html new file mode 100644 index 0000000..45516a3 --- /dev/null +++ b/layouts/shortcodes/graphviz.html @@ -0,0 +1,16 @@ +
+ {{ with .Get "file" }} + {{ if eq (. | printf "%.1s") "/" }} + {{/* Absolute path are from root of site. */}} + {{ $.Scratch.Set "filepath" . }} + {{ else }} + {{/* Relative paths are from page directory. */}} + {{ $.Scratch.Set "filepath" $.Page.File.Dir }} + {{ $.Scratch.Add "filepath" . }} + {{ end }} + + {{ $.Scratch.Get "filepath" | readFile }} + {{ else }} + {{.Inner}} + {{ end }} +