@@ -7,18 +7,53 @@ import {Test} from 'unist-util-is'
7
7
declare namespace mdastUtilToc {
8
8
9
9
interface TOCOptions {
10
+ /**
11
+ * Heading to look for, wrapped in `new RegExp('^(' + value + ')$', 'i')`.
12
+ */
10
13
heading ?: string
14
+
15
+ /**
16
+ * Maximum heading depth to include in the table of contents (default: `6`),
17
+ * This is inclusive: when set to `3`,
18
+ * level three headings are included (those with three hashes, `###`).
19
+ */
11
20
maxDepth ?: Heading [ 'depth' ]
21
+
22
+ /**
23
+ * Headings to skip, wrapped in `new RegExp('^(' + value + ')$', 'i')`.
24
+ * Any heading matching this expression will not be present in the table of contents.
25
+ */
12
26
skip ?: string
27
+
28
+ /**
29
+ * Whether to compile list-items tightly (default: `false`).
30
+ */
13
31
tight ?: boolean
32
+
33
+ /**
34
+ * Add a prefix to links to headings in the table of contents (default: null).
35
+ * Useful for example when later going from mdast to hast and sanitizing with `hast-util-sanitize`.
36
+ */
14
37
prefix ?: string
38
+
39
+ /**
40
+ * Allows headings to be children of certain node types
41
+ * (default: the to `toc` given `tree`, to only allow top-level headings).
42
+ * Internally, uses `unist-util-is` to check, so `parents` can be any `is`-compatible test.
43
+ *
44
+ * For example, this would allow headings under either `root` or `blockquote` to be used:
45
+ *
46
+ * ```ts
47
+ * toc(tree, {parents: ['root', 'blockquote']})
48
+ * ```
49
+ */
15
50
parents ?: Test < Node > | Array < Test < Node > >
16
51
}
17
52
18
53
interface TOCResult {
19
- index ? : number
20
- endIndex ? : number
21
- map ? : List
54
+ index : number | null
55
+ endIndex : number | null
56
+ map : List | null
22
57
}
23
58
}
24
59
0 commit comments