I often need to embed diagrams into documentation but I dislike having to keep track of separate files for the image. I went looking for a way to embed them as “code” in the document and found GitLab’s ability to embed PlantUML in Markdown content including READMEs, issues, MRs, etc. I want to be able to do the same with Hugo.
[Read More]GitLab Snippets in Hugo
I needed to embed a GitLab Snippet into a page here on the site earlier today
so I added layouts/shortcodes/snippet.html
with the content below.
<script src="https://gitlab.com/-/snippets/{{ index .Params 0 }}.js"></script>
Now I can embed snippets just like Gists except using snippet
in place of gist
and it only takes the single number parameter. I’d put an example here but I can’t figure out how to make Hugo ignore it.