Skip to content

Commit 30e73de

Browse files
committed
Remove use of remark-slug
This was a “hidden feature” of this plugin, which didn’t work recently (GH-21), and it’s better to be explicit. Closes GH-21.
1 parent 7f62ba8 commit 30e73de

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

index.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
'use strict'
22

3-
var slug = require('remark-slug')
43
var util = require('mdast-util-toc')
54

65
module.exports = toc
@@ -13,8 +12,6 @@ function toc(options) {
1312
var depth = settings.maxDepth || 6
1413
var tight = settings.tight
1514

16-
this.use(slug)
17-
1815
return transformer
1916

2017
function transformer(node) {

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
"index.js"
3333
],
3434
"dependencies": {
35-
"remark-slug": "^5.0.0",
3635
"mdast-util-toc": "^3.0.0"
3736
},
3837
"devDependencies": {

readme.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,13 @@ Generate a Table of Contents.
8080
for links and images too)
8181
* Removes all following contents until an equal or higher heading is found
8282
* Inserts a list representation of the hierarchy of following headings
83-
* Adds links to following headings, using the same slugs as GitHub
83+
* Links from the table of contents to following headings, using the same slugs
84+
as GitHub
85+
86+
> **Note**: if you’re later compiling to HTML, you still need to add anchors to
87+
> headings.
88+
> Previously that was done by this plugin as well, but now you must
89+
> [`.use(slug)` to include `remark-slug`][slug] explicitly.
8490
8591
##### `options`
8692

@@ -101,14 +107,16 @@ are included (those with three hashes, `###`).
101107

102108
## Related
103109

110+
* [`remark-slug`][slug]
111+
– Add anchors to headings using GitHub’s algorithm
104112
* [`remark-collapse`](https://github.com/Rokt33r/remark-collapse)
105113
– Make a section collapsible
106-
* [`remark-normalize-headings`](https://github.com/eush77/remark-normalize-headings)
114+
* [`remark-normalize-headings`](https://github.com/remarkjs/remark-normalize-headings)
107115
— Make sure there is no more than a single top-level heading in the document
108116
and rewrite the rest accordingly
109117
* [`remark-behead`](https://github.com/mrzmmr/remark-behead)
110118
— Change header levels
111-
* [`mdast-util-toc`](https://github.com/barrythepenguin/mdast-util-toc)
119+
* [`mdast-util-toc`](https://github.com/syntax-tree/mdast-util-toc)
112120
— Core functionality of this plugin
113121

114122
## Contribute
@@ -168,3 +176,5 @@ abide by its terms.
168176
[author]: https://wooorm.com
169177

170178
[remark]: https://github.com/remarkjs/remark
179+
180+
[slug]: https://github.com/remarkjs/remark-slug

0 commit comments

Comments
 (0)