How to include PlantUML in Asciidoc with Antora?
Asked Answered
O

1

5

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:

  • include::page$bar.puml[]
  • include::ROOT:page$bar.puml[]
  • include::ProjectName:ROOT:page$bar.puml[]
  • include::{docdir}/bar.puml[]

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
Out answered 4/12, 2022 at 11:33 Comment(0)
M
6

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/

Marinelli answered 4/12, 2022 at 23:36 Comment(3)
Thx. I've added an update to th question regarding your answer.Out
you should create an examples directory next to pages and move "bar.puml" in it. Then, use include::example$bar.puml[]. The pages directory is reserved for AsciiDoc files.Marinelli
Thank you very much. After creating an examples directory under ROOT and putting the puml file there, i was able to include it and build the antora site successfully.Out

© 2022 - 2024 — McMap. All rights reserved.