Toc - Table of contents
=Toc
is a block that inserts a table of contents (TOC). Usually a table of contents is an index of headers in a document.
By default =Toc
block inserts header with all levels. For example for document which contains =head1
, =head2
, =head3
TOC may be:
About
Intro
Start
Continue
Content
Story 1
First step
Second step
Story 2
First step
Second step
Links
The number of levels (i.e., depth) of the TOC is configurable. For example, to place a table of contents listing only top- and second-level headings:
=Toc head1, head2
Its produce TOC like this:
About
Intro
Content
Story 1
Story 2
Links
To add title for TOC use :title
attribute:
=for Toc :title<"Table of content">
head1, head2
be rendered:
Table of content
About
Intro
Content
Story 1
Story 2
Links
=Toc
block support comma separated list of block names to build TOC for. It is possible to mix various block.
As this:
=Toc head1, table, item1
For example, to place a index of images, diagrams (assuming a user-defined Diagram
block):
=for Toc :title<"Table of visuals">
Image, Diagram
=for Image :caption<Logo image>
256x256.png
=for Diagram :caption<Flow diagram>
...
Will render to:
Table of visuals
Logo image
Flow diagram
Here are is few notes about how TOC is builds:
for blocks such as
=table
,=Image
or=Diagram
( or any user-defined) to make TOC, content of:caption
or:title
attribute is used. If no suitable content is found to be shown in the TOC, "do not have :caption" is used instead.only headings switch indent level for TOC. Other blocks uses level relative to current heading level.
each SEMANTIC block is equivalent to
=head1
A document may have as many
=Toc
blocks as necessary.