Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breaking: remove remark-toc plugin #118

Merged
merged 1 commit into from
Apr 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 0 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,6 @@
[![Markdown Style Guide](https://img.shields.io/badge/hallmark-informational?logo=markdown)](https://github.com/vweevers/hallmark)
[![Common Changelog](https://common-changelog.org/badge.svg)](https://common-changelog.org)

## Table of Contents

<details><summary>Click to expand</summary>

- [Why](#why)
- [Quick Start](#quick-start)
- [What You Might Do](#what-you-might-do)
- [Requirements](#requirements)
- [Rules](#rules)
- [Usage](#usage)
- [Commands](#commands)
- [`lint [file...]`](#lint-file)
- [`fix [file...]`](#fix-file)
- [`cc add <target...>`](#cc-add-target)
- [Package Options](#package-options)
- [`ignore`](#ignore)
- [`autolinkReferences`](#autolinkreferences)
- [`changelog`](#changelog)
- [`validateLinks`](#validatelinks)
- [`paddedTable`](#paddedtable)
- [`toc`](#toc)
- [`plugins`](#plugins)
- [`fixers`](#fixers)
- [Opt-in Features](#opt-in-features)
- [Table of Contents](#table-of-contents-1)
- [Reporters](#reporters)
- [Install](#install)
- [License](#license)

</details>

## Why

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

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)).

### `toc`

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)).

### `plugins`

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

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

## Opt-in Features

### Table of Contents

_Note: this feature is likely to change ([#36](https://github.com/vweevers/hallmark/issues/36))._

Add this heading to a markdown file:

```markdown
## Table of Contents
```

Running `hallmark fix` will then create or update a table of contents.

## Reporters

The default reporter is [`vfile-reporter-shiny`](https://github.com/vweevers/vfile-reporter-shiny). Various other reporters are available:
Expand Down
2 changes: 1 addition & 1 deletion cli-dist.js

Large diffs are not rendered by default.

14 changes: 0 additions & 14 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import remarkGfm from 'remark-gfm'
import remarkCommonChangelog from 'remark-common-changelog'
import remarkGithub from 'remark-github'
import remarkAutolinkReferences from 'remark-autolink-references'
import remarkToc from 'remark-toc'
import remarkCollapse from 'remark-collapse'
import path from 'node:path'
import fs from 'node:fs'
import linter from './lint.js'
Expand Down Expand Up @@ -57,7 +55,6 @@ function hallmark (options, callback) {

const paddedTable = rc.paddedTable !== false
const validateLinks = rc.validateLinks !== false
const toc = rc.toc !== false
const changelog = Object.assign({}, rc.changelog, options.changelog)
const plugins = { plugins: concat('plugins', rc, options) }
const fixers = { plugins: concat('fixers', rc, options) }
Expand Down Expand Up @@ -99,10 +96,6 @@ function hallmark (options, callback) {
}]
: null,

// TODO: https://github.com/vweevers/hallmark/issues/36
toc ? [remarkToc, { tight: true }] : null,
toc ? [remarkCollapse, collapseToc()] : null,

fix ? fixers : null,
linter({ fix, repository, paddedTable, validateLinks }),
plugins
Expand Down Expand Up @@ -230,10 +223,3 @@ function repo (cwd, options, rc, pkg) {
function concat (key, rc, options) {
return [].concat(rc[key] || []).concat(options[key] || [])
}

function collapseToc () {
return {
test: /^table of contents$/i,
summary: 'Click to expand'
}
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"find-githost": "^1.0.0",
"remark": "^14.0.1",
"remark-autolink-references": "^2.0.0",
"remark-collapse": "~0.1.2",
"remark-common-changelog": "^2.3.1",
"remark-gfm": "^3.0.1",
"remark-github": "^11.2.2",
Expand Down Expand Up @@ -55,7 +54,6 @@
"remark-lint-table-cell-padding": "^4.1.1",
"remark-lint-table-pipes": "^4.1.0",
"remark-lint-unordered-list-marker-style": "^3.1.0",
"remark-toc": "^8.0.1",
"remark-validate-links": "^12.1.0",
"subarg": "^1.0.0",
"supports-color": "^9.0.2",
Expand All @@ -75,7 +73,9 @@
"tempy": "^3.0.0"
},
"standard": {
"ignore": ["cli-dist.js"]
"ignore": [
"cli-dist.js"
]
},
"repository": {
"type": "git",
Expand Down
Loading