Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateAnchors ¶ added in v0.14.0
func GenerateIDs ¶
Example ¶
a := Article( Section( H2(Id("current"), "Current car"), H2("My first car"), H2("My first car"), H2("My first car"), H3("Broke down"), ), ) GenerateIDs(a, "h2") a.WriteTo(os.Stdout)
Output: <article> <section> <h2 id="current">Current car</h2> <h2 id="myfirstcar">My first car</h2> <h2 id="myfirstcar1">My first car</h2> <h2 id="myfirstcar2">My first car</h2> <h3>Broke down</h3> </section> </article>
func MakeTOC ¶ added in v0.13.0
MakeTOC generates ids for all named elements and generates a TOC into the destination element returning the created UL element.
Example ¶
nav := Nav() a := Article( H1("Programming"), nav, H2("Design"), H3("Diagrams"), Section( H2(Id("myid"), "Test"), H3("Unit"), H3("Integration"), ), ) MakeTOC(nav, a, "h2") nav.WriteTo(os.Stdout)
Output: <nav><ul> <li class="h2"><a href="#design">Design</a></li> <li class="h2"><a href="#myid">Test</a></li> </ul> </nav>
func ParseTOC ¶
ParseTOC returns ul > li of all named elements.
Example ¶
a := Article( H1("Programming"), H2("Design"), H2("Design"), H3("Diagrams"), Section( H2(Id("myid"), "Test"), H3("Unit"), H3("Integration"), ), ) toc := ParseTOC(a, "h2") toc.WriteTo(os.Stdout)
Output: <ul> <li class="h2"><a href="#design">Design</a></li> <li class="h2"><a href="#design1">Design</a></li> <li class="h2"><a href="#myid">Test</a></li> </ul>
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.