Skip to content

Commit 386fa3f

Browse files
author
Will O'Brien
committed
Merge branch 'Arttse-master'
2 parents 00b4b42 + 2e06223 commit 386fa3f

19 files changed

+509
-19
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,15 @@ By default, doctoc puts the TOC at the top of the file. To place it somewhere el
3737
<!-- END doctoc -->
3838
```
3939

40-
Custom `title` and `depth` options are also accepted
40+
Custom `title`, `depth`, `mode` and `notitle` options are also accepted
4141

4242
```
4343
// ...
4444
.pipe(toc({
4545
title: "Table des matières",
46-
depth: 3
46+
depth: 3,
47+
mode: "bitbucket.org",
48+
notitle: true
4749
}))
4850
// ...
4951
```

index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ var through = require('through2'),
77
module.exports = function(opts){
88
if(opts == null){opts = {};}
99
var title = opts.title || "",
10-
depth = opts.depth || 4;
10+
notitle = opts.notitle || false,
11+
depth = opts.depth || 4,
12+
mode = opts.mode || null;
1113

1214
var addToc = function (file){
13-
var mdWithToc = doctoc(file.contents.toString('utf8'), null, depth, title).data;
15+
var mdWithToc = doctoc(file.contents.toString('utf8'), mode, depth, title, notitle).data;
1416
mdWithToc = mdWithToc || file.contents.toString();
1517
file.contents = new Buffer(mdWithToc, 'utf8');
1618
return file;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"url": "https://github.com/will-ob/gulp-doctoc/issues"
2020
},
2121
"dependencies": {
22-
"doctoc": "^0.12.0",
22+
"doctoc": "^0.15.0",
2323
"gulp-util": "~2.2.14",
2424
"through2": "~0.4.1"
2525
},

test/fixture/after-w-depth.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
55
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
6-
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
6+
77

88
- [Hello](#hello)
99

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
# Article
3+
4+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
5+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
6+
7+
8+
- [Hello](#markdown-header-hello)
9+
- [World](#markdown-header-world)
10+
- [Hi](#markdown-header-hi)
11+
12+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
13+
14+
## Hello
15+
16+
### World
17+
18+
### Hi
19+
20+
21+

test/fixture/after-w-mode-github.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
# Article
3+
4+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
5+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
6+
7+
8+
- [Hello](#hello)
9+
- [World](#world)
10+
- [Hi](#hi)
11+
12+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
13+
14+
## Hello
15+
16+
### World
17+
18+
### Hi
19+
20+
21+

test/fixture/after-w-mode-gitlab.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
# Article
3+
4+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
5+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
6+
7+
8+
- [Hello](#hello)
9+
- [World](#world)
10+
- [Hi](#hi)
11+
12+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
13+
14+
## Hello
15+
16+
### World
17+
18+
### Hi
19+
20+
21+

test/fixture/after-w-notitle.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
# Article
3+
4+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
5+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
6+
7+
8+
- [Hello](#hello)
9+
- [World](#world)
10+
- [Hi](#hi)
11+
12+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
13+
14+
## Hello
15+
16+
### World
17+
18+
### Hi
19+
20+
21+

test/fixture/after-w-title.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
55
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
6-
6+
***Custom title Table of Contents***
77

88
- [Hello](#hello)
99
- [World](#world)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
2+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
3+
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
4+
5+
- [Article](#article)
6+
- [Hello](#hello)
7+
8+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
9+
10+
11+
# Article
12+
13+
14+
## Hello
15+
16+
### World
17+
18+
### Hi
19+
20+
21+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
2+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
3+
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
4+
5+
- [Article](#markdown-header-article)
6+
- [Hello](#markdown-header-hello)
7+
- [World](#markdown-header-world)
8+
- [Hi](#markdown-header-hi)
9+
10+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
11+
12+
13+
# Article
14+
15+
16+
## Hello
17+
18+
### World
19+
20+
### Hi
21+
22+
23+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
2+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
3+
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
4+
5+
- [Article](#article)
6+
- [Hello](#hello)
7+
- [World](#world)
8+
- [Hi](#hi)
9+
10+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
11+
12+
13+
# Article
14+
15+
16+
## Hello
17+
18+
### World
19+
20+
### Hi
21+
22+
23+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
2+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
3+
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
4+
5+
- [Article](#article)
6+
- [Hello](#hello)
7+
- [World](#world)
8+
- [Hi](#hi)
9+
10+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
11+
12+
13+
# Article
14+
15+
16+
## Hello
17+
18+
### World
19+
20+
### Hi
21+
22+
23+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
2+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
3+
4+
5+
- [Article](#article)
6+
- [Hello](#hello)
7+
- [World](#world)
8+
- [Hi](#hi)
9+
10+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
11+
12+
13+
# Article
14+
15+
16+
## Hello
17+
18+
### World
19+
20+
### Hi
21+
22+
23+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
2+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
3+
***Custom title Table of Contents***
4+
5+
- [Article](#article)
6+
- [Hello](#hello)
7+
- [World](#world)
8+
- [Hi](#hi)
9+
10+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
11+
12+
13+
# Article
14+
15+
16+
## Hello
17+
18+
### World
19+
20+
### Hi
21+
22+
23+

test/fixture/after-wo-location.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
2+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
3+
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
4+
5+
- [Article](#article)
6+
- [Hello](#hello)
7+
- [World](#world)
8+
- [Hi](#hi)
9+
10+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
11+
12+
13+
# Article
14+
15+
16+
## Hello
17+
18+
### World
19+
20+
### Hi
21+
22+
23+

test/fixture/after.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
55
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
6-
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
6+
77

88
- [Hello](#hello)
99
- [World](#world)

test/fixture/before-wo-location.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
# Article
3+
4+
5+
## Hello
6+
7+
### World
8+
9+
### Hi
10+
11+
12+

0 commit comments

Comments
 (0)