I have crafted a docker image with hugo and asciidoctor  that has support for asciimath.
My problem is that I cannot get my site to build the asciimath formulas unless I use a script in my site’s top folder to call asciidoctor. The script and my site is at .
The script looks like this:
/bin/bash if [ -f /usr/local/bin/asciidoctor ]; then ad="/usr/local/bin/asciidoctor" else ad="/usr/bin/asciidoctor" fi $ad -v -B . -r asciidoctor-diagram -a icons=font -a docinfo=shared -a nofooter -a sectanchors -a experimental=true -a figure-caption! -a source-highlighter=highlightjs -a toc-title! -a stem=asciimath - | sed -E -e "s/img src=\"([^/]+)\"/img src=\"\/diagram\/\1\"/" mkdir -p static/diagram if ls *.svg >/dev/null 2>&1; then mv -f *.svg static/diagram fi if ls *.png >/dev/null 2>&1; then mv -f *.png static/diagram fi
I have not come up with this, but it works when you call the docker image like this:
docker run --rm -p 1313:1313 -v $PWD:/hugo-project -e PATH=/hugo-project:$PATH lehoff/hugo-asciidoctor:latest hugo -v server --bind 0.0.0.0 --renderToDisk --disableFastRender --disableLiveReload -d /hugo-project
I have tried to make hugo call asciidoctor with the same parameters using the
markup.asciidocext mechanism like this:
extensions = [“asciidoctor-mathematical”, “asciidoctor-diagram”]
workingFolderCurrent = true
stem = “asciimath”
experimental = “true”
setanchors = “”
(I have not figured out to get
-a stem instead of
-a stem=asciimath - also open to input on that.)
When I try to get hugo to call asciidoctor this way the asciimath content comes out as
\$sqrt(4) = 2\$ instead of a nice square root sign.
This is quite annoying. That one has to hack it a bit a minor problem, but using the standard way seems better. The real issue is that my hack with the script does not work with Gitlab CI, or at least I haven’t found a way to make it work, and to be honest I’d rather do things without hacks.
My docker image is using asciidoctor 2.0.10 and hugo 0.74.3 which should be almost the tip of the iceberg.
To sum it up I would like to use asciimath formulas on my site and have it work using only regular config changes. I belive that will make it work with Gitlab CI, which is the ultimate goal.
Let me know if I need to provide more info.
Thanks in advance,