File tree Expand file tree Collapse file tree 2 files changed +6
-16
lines changed Expand file tree Collapse file tree 2 files changed +6
-16
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ var toc = require('mdast-util-toc');
23
23
Transform:
24
24
25
25
``` javascript
26
- var file = remark ().parse ( ([
26
+ var input = remark ().parse ([
27
27
' # Alpha' ,
28
28
' ' ,
29
29
' ## Bravo' ,
@@ -33,18 +33,9 @@ var file = remark().parse(([
33
33
' ## Delta' ,
34
34
' '
35
35
].join (' \n ' ));
36
- ` ` `
37
-
38
- Yields:
39
-
40
- ` ` ` markdown
41
- - [Alpha]
42
-
43
- - [Bravo](#bravo)
44
-
45
- - [Charlie](#charlie)
46
36
47
- - [Delta](#delta)
37
+ toc (input);
38
+ // [ { type: 'list', ordered: false, children: [ { ... } ] } ]
48
39
```
49
40
50
41
## API
@@ -53,9 +44,8 @@ Yields:
53
44
54
45
Generate a Table of Contents from a Markdown document.
55
46
56
- * Looks for the first heading containing ` " Table of Contents" ` , ` " toc" ` ,
57
- or ` table- of - contents` (case insensitive, supports alt/title attributes
58
- for links and images too);
47
+ * If specified, looks for the first heading containing the ` heading ` option
48
+ (case insensitive, supports alt/title attributes for links and images too);
59
49
60
50
* Removes all following contents until an equal or higher heading is found;
61
51
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " mdast-util-toc" ,
3
- "version" : " 1.0 .0" ,
3
+ "version" : " 0.1 .0" ,
4
4
"description" : " Generate a Table of Contents (TOC) from a given Markdown file" ,
5
5
"main" : " index.js" ,
6
6
"files" : [
You can’t perform that action at this time.
0 commit comments