Skip to content

Commit 218a26f

Browse files
readme example usage
1 parent a7fa70e commit 218a26f

File tree

2 files changed

+6
-16
lines changed

2 files changed

+6
-16
lines changed

README.md

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ var toc = require('mdast-util-toc');
2323
Transform:
2424

2525
```javascript
26-
var file = remark().parse(([
26+
var input = remark().parse([
2727
'# Alpha',
2828
'',
2929
'## Bravo',
@@ -33,18 +33,9 @@ var file = remark().parse(([
3333
'## Delta',
3434
''
3535
].join('\n'));
36-
```
37-
38-
Yields:
39-
40-
```markdown
41-
- [Alpha]
42-
43-
- [Bravo](#bravo)
44-
45-
- [Charlie](#charlie)
4636

47-
- [Delta](#delta)
37+
toc(input);
38+
// [ { type: 'list', ordered: false, children: [ { ... } ] } ]
4839
```
4940

5041
## API
@@ -53,9 +44,8 @@ Yields:
5344

5445
Generate a Table of Contents from a Markdown document.
5546

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);
5949

6050
* Removes all following contents until an equal or higher heading is found;
6151

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mdast-util-toc",
3-
"version": "1.0.0",
3+
"version": "0.1.0",
44
"description": "Generate a Table of Contents (TOC) from a given Markdown file",
55
"main": "index.js",
66
"files": [

0 commit comments

Comments
 (0)