The v3.1.0 release of the asciidoctor-diagram extension introduced the ability to cache generated image files in addition to the existing metadata files.
To make this work in a Hugo context, we need to:
- Set the
diagram-cache-images-option document attribute to true
- Set the
diagram-cachedir document attribute to a path outside of the publishDir
Implementation details:
- The
diagram-cache-images-option attribute will be hardcoded to true. Caching metadata files without caching image files defeats the purpose of caching when building a site. To disable caching entirely (both image and metadata files), users should set the diagram-nocache-option document attribute to true.
- The the
diagram-cachedir attribute will be set to the compiled value of the caches.misc.dir setting in the site config, normalized for the current OS.
- Users will be warned if they attempt to override either
diagram-cache-images-option or diagram-cachedir in the site config.
The v3.1.0 release of the asciidoctor-diagram extension introduced the ability to cache generated image files in addition to the existing metadata files.
To make this work in a Hugo context, we need to:
diagram-cache-images-optiondocument attribute totruediagram-cachedirdocument attribute to a path outside of thepublishDirImplementation details:
diagram-cache-images-optionattribute will be hardcoded totrue. Caching metadata files without caching image files defeats the purpose of caching when building a site. To disable caching entirely (both image and metadata files), users should set thediagram-nocache-optiondocument attribute totrue.diagram-cachedirattribute will be set to the compiled value of thecaches.misc.dirsetting in the site config, normalized for the current OS.diagram-cache-images-optionordiagram-cachedirin the site config.