Search

Dark theme | Light theme

May 1, 2009

Use anchors in Maven APT project site documentation

Maven supports the APT (Almost Plain Text) format to create documentation. We can even create anchors and links to the anchors in our documentation:

{Simple title}

    We can write our documentation paragraph as always with <<bold>>
    or <italic> text.

{Another section}

    We can link to our {{{Simple_title}Simple title}} section by using the anchor 
    link. We must make sure we replace spaces in an anchor text with underscores.

This will result in the following HTML:

<div class="section"><h2><a name="Simple_title">Simple title</a></h2> 
<p>We can write our documentation paragraph as always with <b>bold</b> or <i>italic</i> text.</p> 
</div> 
<div class="section"><h2><a name="Another_section">Another section</a></h2> 
<p>We can to our <a href="#Simple_title">Simple title</a> section by using the anchor link.</p> 
</div>