Search code examples
xmlanchorconfluencedita

Confluence Storage Format - Anyone played with anchor and anchor-link macro


I am parsing dita xml and I have to generate Confluence Storage Format.

I am facing difficulty with Anchor macro, while dita format have xref who behave the same way as html local link <xref href="#id">title</xref>....<any id="id"..., confluence seam to have its own unique synthax.

Did someone have any good example on how to build a correct anchor and link it properly?


Solution

  • I finally figured it out.

    Instead of id on an element, we insert an anchor were the link should send the user, I inserted it just above the header. <ac:structured-macro ac:name="anchor"><ac:parameter ac:name="">The_Id</ac:parameter></ac:structured-macro>

    And anchor link are built like these. <ac:link ac:anchor="The_Id"><ac:plain-text-link-body><[CDATA[text describing the link]]></ac:plain-text></ac:link>

    Tested on Confluence 5.7