remark-toc
Advanced tools
Comparing version 7.0.0 to 7.1.0
18
index.js
@@ -7,10 +7,4 @@ 'use strict' | ||
var defaultHeading = 'toc|table[ -]of[ -]contents?' | ||
function toc(options) { | ||
var settings = options || {} | ||
var heading = settings.heading || defaultHeading | ||
var depth = settings.maxDepth || 6 | ||
var tight = settings.tight | ||
var skip = settings.skip | ||
@@ -20,8 +14,8 @@ return transformer | ||
function transformer(node) { | ||
var result = util(node, { | ||
heading: heading, | ||
maxDepth: depth, | ||
tight: tight, | ||
skip: skip | ||
}) | ||
var result = util( | ||
node, | ||
Object.assign({}, settings, { | ||
heading: settings.heading || 'toc|table[ -]of[ -]contents?' | ||
}) | ||
) | ||
@@ -28,0 +22,0 @@ if (result.index === null || result.index === -1 || !result.map) { |
{ | ||
"name": "remark-toc", | ||
"version": "7.0.0", | ||
"version": "7.1.0", | ||
"description": "remark plugin to generate a Table of Contents (TOC)", | ||
@@ -9,2 +9,3 @@ "license": "MIT", | ||
"remark", | ||
"remark-plugin", | ||
"plugin", | ||
@@ -46,17 +47,17 @@ "mdast", | ||
"devDependencies": { | ||
"browserify": "^16.0.0", | ||
"dtslint": "^2.0.0", | ||
"is-hidden": "^1.1.0", | ||
"browserify": "^17.0.0", | ||
"dtslint": "^4.0.0", | ||
"is-hidden": "^1.0.0", | ||
"negate": "^1.0.0", | ||
"nyc": "^15.0.0", | ||
"prettier": "^1.0.0", | ||
"remark": "^11.0.0", | ||
"remark-cli": "^7.0.0", | ||
"remark-preset-wooorm": "^6.0.0", | ||
"tape": "^4.0.0", | ||
"tinyify": "^2.0.0", | ||
"xo": "^0.25.0" | ||
"prettier": "^2.0.0", | ||
"remark": "^13.0.0", | ||
"remark-cli": "^9.0.0", | ||
"remark-preset-wooorm": "^8.0.0", | ||
"tape": "^5.0.0", | ||
"tinyify": "^3.0.0", | ||
"xo": "^0.37.0" | ||
}, | ||
"scripts": { | ||
"format": "remark *.md -qfo && prettier --write \"**/*.js\" && xo --fix", | ||
"format": "remark . -qfo --ignore-pattern test/ && prettier . -w --loglevel warn && xo --fix", | ||
"build-bundle": "browserify . -s remarkToc > remark-toc.js", | ||
@@ -81,3 +82,8 @@ "build-mangle": "browserify . -s remarkToc -p tinyify > remark-toc.min.js", | ||
"esnext": false, | ||
"rules": { | ||
"unicorn/no-fn-reference-in-iterator": "off", | ||
"unicorn/prefer-optional-catch-binding": "off" | ||
}, | ||
"ignores": [ | ||
"types/", | ||
"remark-toc.js" | ||
@@ -84,0 +90,0 @@ ] |
@@ -11,3 +11,3 @@ # remark-toc | ||
[**remark**][remark] plugin to generate a Table of Contents. | ||
[**remark**][remark] plugin to generate a table of contents. | ||
@@ -77,3 +77,3 @@ ## Install | ||
Generate a Table of Contents. | ||
Generate a table of contents. | ||
@@ -95,23 +95,5 @@ * Looks for the first heading containing `'Table of Contents'`, `'toc'`, | ||
###### `options.heading` | ||
All options are passed to [`mdast-util-toc`][util], with the exception that | ||
`heading` defaults to `'toc|table[ -]of[ -]contents?'`. | ||
`string?`, default: `'toc|table[ -]of[ -]contents?'` — Heading to look for, | ||
wrapped in `new RegExp('^(' + value + ')$', 'i')`. | ||
###### `options.maxDepth` | ||
`number?`, default: `6` — Maximum heading depth to include in the table of | ||
contents, This is inclusive, thus, when set to `3`, level three headings, | ||
are included (those with three hashes, `###`). | ||
###### `options.tight` | ||
`boolean?`, default: `false` — Whether to compile list-items tightly. | ||
###### `options.skip` | ||
`string?` — Headings to skip, wrapped in `new RegExp('^(' + value + ')$', 'i')`. | ||
Any heading matching this expression will not be present in the table of | ||
contents. | ||
## Security | ||
@@ -172,4 +154,4 @@ | ||
This project has a [Code of Conduct][coc]. | ||
By interacting with this repository, organisation, or community you agree to | ||
This project has a [code of conduct][coc]. | ||
By interacting with this repository, organization, or community you agree to | ||
abide by its terms. | ||
@@ -183,5 +165,5 @@ | ||
[build-badge]: https://img.shields.io/travis/remarkjs/remark-toc/master.svg | ||
[build-badge]: https://github.com/remarkjs/remark-toc/workflows/main/badge.svg | ||
[build]: https://travis-ci.org/remarkjs/remark-toc | ||
[build]: https://github.com/remarkjs/remark-toc/actions | ||
@@ -206,5 +188,5 @@ [coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-toc.svg | ||
[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg | ||
[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg | ||
[chat]: https://spectrum.chat/unified/remark | ||
[chat]: https://github.com/remarkjs/remark/discussions | ||
@@ -215,7 +197,7 @@ [npm]: https://docs.npmjs.com/cli/install | ||
[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md | ||
[contributing]: https://github.com/remarkjs/.github/blob/HEAD/contributing.md | ||
[support]: https://github.com/remarkjs/.github/blob/master/support.md | ||
[support]: https://github.com/remarkjs/.github/blob/HEAD/support.md | ||
[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md | ||
[coc]: https://github.com/remarkjs/.github/blob/HEAD/code-of-conduct.md | ||
@@ -235,1 +217,3 @@ [license]: license | ||
[hast]: https://github.com/syntax-tree/hast | ||
[util]: https://github.com/syntax-tree/mdast-util-toc#options |
@@ -7,3 +7,3 @@ // Minimum TypeScript Version: 3.2 | ||
declare namespace remarkToc { | ||
type TOCSettings = Pick<TOCOptions, 'heading' | 'maxDepth' | 'tight' | 'skip'>; | ||
type TOCSettings = Pick<TOCOptions, 'heading' | 'maxDepth' | 'tight' | 'skip'> | ||
} | ||
@@ -10,0 +10,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9640
38
212