asciidocasciidoctorantora

How to include PlantUML in Asciidoc with Antora?


I would like to inlcude a PlantUML file inside an Asciidoc file and build an Antora site.

foo.adoc

[plantuml, bar, svg]
....
include::bar.puml[]
....

bar.puml

@startuml
<... valid PlantUML>
@enduml

The PlantUML does show up correctly inside my IDE (IntelliJ).

Problem

When i run antora antora-playbook.yml, i get the following error:

ERROR (asciidoctor): target of include not found: bar.puml
    file: /$PROJECT_PATH/docs/modules/ROOT/pages/foo.adoc:11
    source: /$PROJECT_PATH (branch: #branch-name <worktree> | start path: docs)
Skipping plantuml block. GET https://kroki.io/plantuml/svg/<image-id> - server returns an empty response or a 404 status code

Everything works fine if i use inline PlantUML instead of an include statement.

Update

I've already tried to use the following Antora Resource ID's:

The error message remains the same: target of include not found: ...

My project structure looks like this:

- modules
  - antora.yml
  - antora-playbook.yml
  - ROOT
    - pages
      - foo.adoc
      - bar.puml

Solution

  • The root cause is: ERROR (asciidoctor): target of include not found: bar.puml. When working with Antora, you should reference a resource using an Antora resource ID: https://docs.antora.org/antora/latest/page/resource-id/

    [plantuml, bar, svg]
    ....
    include::example$bar.puml[]
    ....
    

    https://docs.antora.org/antora/latest/page/include-an-example/