directives:toc

toc generates a table of contents. See the reference documentation for a complete description.

Note the use of the toc class name in the ordered/unordered list element enclosing the TOC and id's in the heading elements.

Also see the sitemap functionality of natural mode.

Xilize markup browser rendering
xilize. css examples.css

h1. my page heading

complete table of contents for this page

toc. 2 4 *

h2. a level 2 heading

toc. 3 3 #

h3. first level 3 heading

some text

h4. level 4 heading

more text

h3. second level 3 heading

some more text

my page heading

complete table of contents for this page

a level 2 heading

  1. first level 3 heading
  2. second level 3 heading

first level 3 heading

some text

level 4 heading

more text

second level 3 heading

some more text

XHTML generated

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <link href="examples.css" rel="stylesheet" type="text/css" />
</head>
<body>

<h1 id="id2">my page heading</h1>

<p>complete table of contents for this page</p>

<ul class="toc">
  <li><a href="#id3"> a level 2 heading </a>
    <ul>
      <li><a href="#id4"> first level 3 heading </a>
        <ul>
          <li><a href="#id5"> level 4 heading </a></li>
        </ul>
      </li>
      <li><a href="#id6"> second level 3 heading </a></li>
    </ul>
  </li>
</ul>

<h2 id="id3">a level 2 heading</h2>

<ol class="toc">
  <li><a href="#id4"> first level 3 heading </a></li>
  <li><a href="#id6"> second level 3 heading </a></li>
</ol>

<h3 id="id4">first level 3 heading</h3>

<p>some text</p>

<h4 id="id5">level 4 heading</h4>

<p>more text</p>

<h3 id="id6">second level 3 heading</h3>

<p>some more text</p>

</body>
</html>