Howto use asciidoctor with ditaa

Hi there,
I try to use asciidoctor with the diagram extension to automatically embed some ditaa asciiart images. However I always get the error: Failed to generate image: Could not find Java executable

I have this installed

  • jre8
  • ditaa
  • asciidoctor-with-extensions
{ pkgs ? import <nixpkgs> {} }:

  pkgs.mkShell {
    buildInputs = with pkgs; [


Has anyone a working setup with asciidoctor and ditaa?

1 Like

The asciidoctor-with-extensions package already includes ditaa because it’s bundled with the asciidoctor-diagram-ditaamini gem, so you shouldn’t need to specify the ditaa package.

The missing piece is the JRE, and I’d consider that a bug in asciidoctor-with-extensions. Providing a JRE allows the extension to work:

$ nix-shell --packages '[ asciidoctor-with-extensions jre ]'
$ cat 'example.adoc'
+---+   +---+
| A +-->| B |
+---+   +---+
$ asciidoctor --require 'asciidoctor-diagram' 'example.adoc'
$ grep 'png' 'example.html'
<img src="diag-7c2dcbc30e91f352813c1d74d0e53950.png" alt="Diagram" width="170" height="98">
$ display 'diag-7c2dcbc30e91f352813c1d74d0e53950.png'

display diag-7c2dcbc30e91f352813c1d74d0e53950.png

I’ve proposed an update to asciidoctor-with-extensions, so hopefully in the future it should work out of the box.

1 Like

Thank you,
when I added the JRE it finally worked. Great to hear that this will also be fixed in nixpkgs