簡體   English   中英

如何使用 Antora 在 Asciidoc 中包含 PlantUML?

[英]How to include PlantUML in Asciidoc with Antora?

我想在Asciidoc文件中包含一個PlantUML文件並構建一個Antora站點。

foo.adoc

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

酒吧.puml

@startuml
<... valid PlantUML>
@enduml

PlantUML 確實在我的 IDE (IntelliJ) 中正確顯示。

問題

當我運行antora antora-playbook.yml時,出現以下錯誤:

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

如果我使用內聯 PlantUML 而不是include語句,一切正常。

更新

我已經嘗試使用以下 Antora 資源 ID:

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

錯誤消息保持不變: target of include not found: ...

我的項目結構如下所示:

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

根本原因是: ERROR (asciidoctor): target of include not found: bar.puml 使用 Antora 時,您應該使用 Antora 資源 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/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM