The
toc
command reads an HTML file, inserts ID attributes in all H1 to H6 that
don't have one already, and also inserts A elements with NAME
attributes, so old browsers will recognize the H1 to H6 headers as
target anchors as well. The output is written to stdout.
If there is a comment of the form
<!--toc-->
or a pair of comments
<!--begin-toc-->
...
<!--end-toc-->
then the comment, or the pair with everything in between will be
replaced by a table of contents, consisting of a list (UL) of links to
all headers in the document.
The text of headers is copied to this table of contents, including any
inline markup, except that DFN tags and SPAN tags with a CLASS of
"index" are omitted (but the elements content is copied).
If a header has a CLASS attribute with as value (or one of its values)
the keyword "no-toc", then that header will not appear in the table
of contents.
Normally,
toc
adds both ID attributes and empty A elements with a NAME attribute and
CLASS="bctarget", so that older browsers that do no understand ID will
still find the target. With this option, the A elements will not be
generated.