Search code examples
asciidoctorplantuml

activiating plantuml from asciidoctor


I want to activate plantuml from asciidoctor

From asciidctor I learned:

anchor:id[optional xreflabel]

is equal to

[[id,optional xreflabel]]

but where is the anchor?

linux mint asciidoctor 1.5.6 GraphViz installed

preview in IntelliJ with asciidoctor plugin does not work

plantuml::images/diagramm.puml[] // works

[plantuml,images/diagramm.puml] // works not

how to write the correct embedding?


Solution

  • You are asking two distinct questions.

    First, the anchor:id[optional xref label] syntax is equivalent to [[id, optional xref label]]. These provide a target location within a document that cross-reference links can point to, but anchors are not themselves visible. The optional label is used to label links that point to the anchors.

    For example, when this Asciidoctor document is converted to HTML:

    = Document
    
    First: anchor:alice[Alice]
    
    Second: [[bob, Bob]]
    
    Link to <<alice>>.
    
    Link to <<bob>>.
    

    the HTML looks like:

    ...
    <div id="header">
    <h1>Document</h1>
    </div>
    <div id="content">
    <div class="paragraph">
    <p>First: <a id="alice"></a></p>
    </div>
    <div class="paragraph">
    <p>Second: <a id="bob"></a></p>
    </div>
    <div class="paragraph">
    <p>Link to <a href="#alice">Alice</a>.</p>
    </div>
    <div class="paragraph">
    <p>Link to <a href="#bob">Bob</a>.</p>
    </div>
    </div>
    ...
    

    If your document includes an anchor but never links to it, the anchor markup is omitted from the output.

    For your second question, you already answered it. When the asciidoctor-plantuml extension is installed, it provides support for the plantuml: macro. Whenever you include plantuml::path/to/plantuml/diagram.puml[] in your document, the extension renders the specified PlantUML diagram file and emits the resulting image where the macro would have appeared in the output.

    Using [plantuml,images/diagramm.puml] would only specify an anchor with the id plantuml, and any cross-reference links that point to it would be literally labelled images/diagramm.puml.