1man(1) General Commands Manual man(1)
2
3
4
6 toc - insert a table of contents in an HTML file
7
9 toc [ -x ] [ -l low ] [ -h high ] [ file ] [ -t ]
10
12 The toc command reads an HTML file, inserts ID attributes in all H1 to
13 H6 that don't have one already, and also inserts A elements with NAME
14 attributes, so old browsers will recognize the H1 to H6 headers as tar‐
15 get anchors as well. The output is written to stdout.
16
17 If there is a comment of the form
18
19 <!--toc-->
20
21 or a pair of comments
22
23 <!--begin-toc-->
24 <!--end-toc-->
25
26 then the comment, or the pair with everything in between will be
27 replaced by a table of contents, consisting of a list (UL) of links to
28 all headers in the document.
29
30 If a header has a CLASS attribute with as value (or one of its values)
31 the keyword "no-toc", then that header will not appear in the table of
32 contents.
33
35 The following options are supported:
36
37 -x Use XML conventions: empty elements are written with a slash
38 at the end: <IMG />
39
40 -l low Sets the lowest numbered header to appear in the table of
41 content. Default is 1 (i.e., H1).
42
43 -h high Sets the highest numbered header to appear in the table of
44 content. Default is 6 (i.e., H6).
45
46 -t Normally, toc adds both ID attributes and empty A elements
47 with a NAME attribute and CLASS="bctarget", so that older
48 browsers that do no understand ID will still find the target.
49 With this option, the A elements will not be generated.
50
52 The following operand is supported:
53
54 file The name of an HTML file. If absent, standard input is read
55 instead.
56
58 The following exit values are returned:
59
60 0 Successful completion.
61
62 >0 An error occurred in the parsing of the HTML file. toc will
63 try to correct the error and produce output anyway.
64
66 num(1), normalize(1), xml2asc(1) asc2xml(1)
67
69 The error recovery for incorrect HTML is primitive.
70
71
72
73 2 Dec 1998 man(1)