Inline ditaa, dot or plantuml sources in hugo posts

How to inline ditaa, dot or plantuml content in hugo posts, etc?

For instance:

{% ditaa %}
/----+  DAAP /-----+-----+ Audio  /--------+
| PC |<------| RPi | MPD |------->| Stereo |
+----+       +-----+-----+        +--------+
   |                 ^ ^
   |     ncmpcpp     | | mpdroid /---------+
   +--------=--------+ +----=----| Nexus S |
                                 +---------+
{% endditaa %}

The same for plantuml or graphviz, etc.

If it possible to run an external executable and have the result be inlined?

What do you mean by inlined?

Fenced code block may be an option:

```
some code
```

In Jekyll, the above ditaa tag will trigger a plugin that will execute a command line executable with optional args, save the generate svg to a file and link the image file to the post. The jekyll build will also copy the generated svg file to the _site output folder.

The above example is specific to the ditaa plugin, but it seems that there could be a single exec tag to rule them all.

In Hugo we have the Highlight shortcode that triggers pygments (code highlighting), but nothing like “trigger any external program”. I guess that’s doable, and might even be a good idea.

1 Like

I created this feature request:

I implemented this locally – and altough very cool, there is this security aspect of it, allowing execution of “all kinds of” commands on a user’s PC (from a shortcode in a theme …).

If we could somehow restrict it …

One option is to use https://github.com/seccomp/libseccomp-golang and https://man.openbsd.org/pledge on BSD to allow only reading files.