Skip to content

Commit

Permalink
Remove use of remark-slug
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
wooorm committed Jun 18, 2019
1 parent 7f62ba8 commit 30e73de
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
3 changes: 0 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict'

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

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

this.use(slug)

return transformer

function transformer(node) {
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"index.js"
],
"dependencies": {
"remark-slug": "^5.0.0",
"mdast-util-toc": "^3.0.0"
},
"devDependencies": {
Expand Down
16 changes: 13 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,13 @@ Generate a Table of Contents.
for links and images too)
* Removes all following contents until an equal or higher heading is found
* Inserts a list representation of the hierarchy of following headings
* Adds links to following headings, using the same slugs as GitHub
* Links from the table of contents to following headings, using the same slugs
as GitHub

> **Note**: if you’re later compiling to HTML, you still need to add anchors to
> headings.
> Previously that was done by this plugin as well, but now you must
> [`.use(slug)` to include `remark-slug`][slug] explicitly.
##### `options`

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

## Related

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

## Contribute
Expand Down Expand Up @@ -168,3 +176,5 @@ abide by its terms.
[author]: https://wooorm.com

[remark]: https://github.com/remarkjs/remark

[slug]: https://github.com/remarkjs/remark-slug

0 comments on commit 30e73de

Please sign in to comment.