Skip to content

Commit 19f4a8f

Browse files
authored
Breaking: remove remark-toc plugin (#118)
If you have a "Table of Contents" section in your README, it will no longer be automatically updated. Either remove it, or add the plugin to hallmark configuration. Ref: #38 Closes: #36 Category: removal
1 parent 26500dd commit 19f4a8f

File tree

4 files changed

+4
-67
lines changed

4 files changed

+4
-67
lines changed

README.md

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -10,37 +10,6 @@
1010
[![Markdown Style Guide](https://img.shields.io/badge/hallmark-informational?logo=markdown)](https://github.com/vweevers/hallmark)
1111
[![Common Changelog](https://common-changelog.org/badge.svg)](https://common-changelog.org)
1212

13-
## Table of Contents
14-
15-
<details><summary>Click to expand</summary>
16-
17-
- [Why](#why)
18-
- [Quick Start](#quick-start)
19-
- [What You Might Do](#what-you-might-do)
20-
- [Requirements](#requirements)
21-
- [Rules](#rules)
22-
- [Usage](#usage)
23-
- [Commands](#commands)
24-
- [`lint [file...]`](#lint-file)
25-
- [`fix [file...]`](#fix-file)
26-
- [`cc add <target...>`](#cc-add-target)
27-
- [Package Options](#package-options)
28-
- [`ignore`](#ignore)
29-
- [`autolinkReferences`](#autolinkreferences)
30-
- [`changelog`](#changelog)
31-
- [`validateLinks`](#validatelinks)
32-
- [`paddedTable`](#paddedtable)
33-
- [`toc`](#toc)
34-
- [`plugins`](#plugins)
35-
- [`fixers`](#fixers)
36-
- [Opt-in Features](#opt-in-features)
37-
- [Table of Contents](#table-of-contents-1)
38-
- [Reporters](#reporters)
39-
- [Install](#install)
40-
- [License](#license)
41-
42-
</details>
43-
4413
## Why
4514

4615
This module saves you time in three ways:
@@ -298,10 +267,6 @@ Boolean. Set to `false` to skip validating links. Useful when a markdown file us
298267

299268
Boolean. Set to `false` to keep markdown tables compact. A temporary option until we decide on and are able to lint a style ([`3210a96`](https://github.com/vweevers/hallmark/commit/3210a96)).
300269

301-
### `toc`
302-
303-
Boolean. Set to `false` to skip generating (or replacing) a Table of Contents. A temporary option until we write a more flexible plugin ([#36](https://github.com/vweevers/hallmark/issues/36)).
304-
305270
### `plugins`
306271

307272
An array of extra plugins, to be applied in both lint and fix mode.
@@ -310,20 +275,6 @@ An array of extra plugins, to be applied in both lint and fix mode.
310275

311276
An array of extra plugins, to be applied in fix mode.
312277

313-
## Opt-in Features
314-
315-
### Table of Contents
316-
317-
_Note: this feature is likely to change ([#36](https://github.com/vweevers/hallmark/issues/36))._
318-
319-
Add this heading to a markdown file:
320-
321-
```markdown
322-
## Table of Contents
323-
```
324-
325-
Running `hallmark fix` will then create or update a table of contents.
326-
327278
## Reporters
328279

329280
The default reporter is [`vfile-reporter-shiny`](https://github.com/vweevers/vfile-reporter-shiny). Various other reporters are available:

cli-dist.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.js

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import remarkGfm from 'remark-gfm'
1010
import remarkCommonChangelog from 'remark-common-changelog'
1111
import remarkGithub from 'remark-github'
1212
import remarkAutolinkReferences from 'remark-autolink-references'
13-
import remarkToc from 'remark-toc'
14-
import remarkCollapse from 'remark-collapse'
1513
import path from 'node:path'
1614
import fs from 'node:fs'
1715
import linter from './lint.js'
@@ -57,7 +55,6 @@ function hallmark (options, callback) {
5755

5856
const paddedTable = rc.paddedTable !== false
5957
const validateLinks = rc.validateLinks !== false
60-
const toc = rc.toc !== false
6158
const changelog = Object.assign({}, rc.changelog, options.changelog)
6259
const plugins = { plugins: concat('plugins', rc, options) }
6360
const fixers = { plugins: concat('fixers', rc, options) }
@@ -99,10 +96,6 @@ function hallmark (options, callback) {
9996
}]
10097
: null,
10198

102-
// TODO: https://github.com/vweevers/hallmark/issues/36
103-
toc ? [remarkToc, { tight: true }] : null,
104-
toc ? [remarkCollapse, collapseToc()] : null,
105-
10699
fix ? fixers : null,
107100
linter({ fix, repository, paddedTable, validateLinks }),
108101
plugins
@@ -230,10 +223,3 @@ function repo (cwd, options, rc, pkg) {
230223
function concat (key, rc, options) {
231224
return [].concat(rc[key] || []).concat(options[key] || [])
232225
}
233-
234-
function collapseToc () {
235-
return {
236-
test: /^table of contents$/i,
237-
summary: 'Click to expand'
238-
}
239-
}

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
"find-githost": "^1.0.0",
2727
"remark": "^14.0.1",
2828
"remark-autolink-references": "^2.0.0",
29-
"remark-collapse": "~0.1.2",
3029
"remark-common-changelog": "^2.3.1",
3130
"remark-gfm": "^3.0.1",
3231
"remark-github": "^11.2.2",
@@ -55,7 +54,6 @@
5554
"remark-lint-table-cell-padding": "^4.1.1",
5655
"remark-lint-table-pipes": "^4.1.0",
5756
"remark-lint-unordered-list-marker-style": "^3.1.0",
58-
"remark-toc": "^8.0.1",
5957
"remark-validate-links": "^12.1.0",
6058
"subarg": "^1.0.0",
6159
"supports-color": "^9.0.2",
@@ -75,7 +73,9 @@
7573
"tempy": "^3.0.0"
7674
},
7775
"standard": {
78-
"ignore": ["cli-dist.js"]
76+
"ignore": [
77+
"cli-dist.js"
78+
]
7979
},
8080
"repository": {
8181
"type": "git",

0 commit comments

Comments
 (0)