How to customise helper command? E.g. how to pass "-r asciidoctor-diagram" to asciidoctor?

Here’s how I deal with images and Asciidoctor: Every post is a leaf bundle and any image that I use in only one post is located in that post’s bundle directory and referenced like this in the post’s index.adoc:

image::./foo.png[alt text]

If you do not set the imagesdir attribute, the above will work.

For any image bar.png that is used in multiple posts, I put it in site-root/static/images and reference it like this:

image::{staticimagesdir}/bar.png[alt text]

I set the staticimagesdir attribute (and other attributes) in a file that I include in all my index.adoc files. Here’s the setting I use:

:staticimagesdir: /images

The reason I name it staticimagesdir is so I will remember that it is in my Hugo site root’s static directory.

I’d love to hear how other people use AsciiDoc with Hugo. I :heart: AsciiDoc, but it has been a challenge to figure out a sane way to use images and includes with Hugo bundles. Some day I will write about AsciiDoc includes, AsciiDoc jails, and Hugo :scream:

2 Likes