Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

remark-toc

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remark-toc - npm Package Compare versions

Comparing version 3.0.0-alpha.1 to 3.0.0-alpha.2

18

package.json
{
"name": "remark-toc",
"version": "3.0.0-alpha.1",
"version": "3.0.0-alpha.2",
"description": "Generate a Table of Contents (TOC) for Markdown files",

@@ -23,4 +23,14 @@ "license": "MIT",

},
"repository": "wooorm/remark-toc",
"author": "Titus Wormer <tituswormer@gmail.com>",
"repository": {
"type": "git",
"url": "https://github.com/wooorm/remark-toc.git"
},
"bugs": "https://github.com/wooorm/remark-toc/issues",
"author": "Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)",
"contributors": [
"Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)"
],
"engines": {
"node": ">=0.10.0"
},
"files": [

@@ -40,3 +50,3 @@ "index.js"

"remark-lint": "^2.0.0",
"remark-usage": "^2.0.0",
"remark-usage": "^2.1.0",
"remark-validate-links": "^2.0.0",

@@ -43,0 +53,0 @@ "tape": "^4.0.0"

@@ -1,9 +0,8 @@

# remark-toc [![Build Status](https://img.shields.io/travis/wooorm/remark-toc.svg)](https://travis-ci.org/wooorm/remark-toc) [![Coverage Status](https://img.shields.io/codecov/c/github/wooorm/remark-toc.svg)](https://codecov.io/github/wooorm/remark-toc)
# remark-toc [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov]
Generate a Table of Contents (TOC) for [Markdown](http://daringfireball.net/projects/markdown/syntax)
files with [remark](https://github.com/wooorm/remark).
Generate a Table of Contents in [**remark**][remark].
## Installation
[npm](https://docs.npmjs.com/cli/install):
[npm][npm-install]:

@@ -14,49 +13,49 @@ ```bash

**remark-toc** is also available for [duo](http://duojs.org/#getting-started),
and as an AMD, CommonJS, and globals module, [uncompressed and
compressed](https://github.com/wooorm/remark-toc/releases).
**remark-toc** is also available as an AMD, CommonJS, and globals
module, [uncompressed and compressed][releases].
## Table of Contents
* [Usage](#usage)
* [API](#api)
* [remark.use(toc, options)](#remarkusetoc-options)
* [License](#license)
## Usage
Require/read dependencies:
Dependencies:
```javascript
var remark = require('remark');
var toc = require('remark-toc');
var fs = require('fs');
var remark = require('remark').use(toc);
var readme = fs.readFileSync('readme.md', 'utf-8');
```
Parse markdown (this TOC is the 7th child).
Process:
```javascript
var contents = remark.run(remark.parse(readme)).children[7];
var doc = remark().use(toc).process([
'# Alpha',
'',
'## Table of Contents',
'',
'## Bravo',
'',
'### Charlie',
'',
'## Delta',
''
].join('\n'));
```
Stringify:
```javascript
var doc = remark.stringify(contents);
```
Yields:
```markdown
- [Usage](#usage)
# Alpha
- [API](#api)
## Table of Contents
- [remark.use(toc, options)](#remarkusetoc-options)
- [Bravo](#bravo)
- [License](#license)
- [Charlie](#charlie)
- [Delta](#delta)
## Bravo
### Charlie
## Delta
```

@@ -66,5 +65,5 @@

### [remark](https://github.com/wooorm/remark#api).[use](https://github.com/wooorm/remark#remarkuseplugin-options)(toc, options)
### `remark.use(toc[, options])`
Adds a [Table of Contents](#table-of-contents) to a Markdown document.
Add a Table of Contents to a Markdown document.

@@ -81,29 +80,42 @@ * Looks for the first heading containing `"Table of Contents"`, `"toc"`,

**Signatures**
**Options** (`Object`, optional):
* `remark.use(toc, options?)`.
* `slug`
— Passed to [`remark-slug`][remark-slug];
**Parameters**
* `heading` (`string?`, default: `"toc|table[ -]of[ -]contents?"`)
— Heading to look for, wrapped in `new RegExp('^(' + value + ')$', 'i');`;
* `toc` — This plugin;
* `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` (`Object?`) — Settings:
* `tight` (`boolean?`, default: `false`)
— Whether to compile list-items tightly.
* `slug` —
Passed to [`remark-slug`](https://github.com/wooorm/remark-slug)
## License
* `heading` (`string?`, default: `"toc|table[ -]of[ -]contents?"`)
— Heading to look for, wrapped in
`new RegExp('^(' + value + ')$', 'i');`.
[MIT][license] © [Titus Wormer][author]
* `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, `###`).
<!-- Definitions -->
* `tight` (`boolean?`, default: `false`)
— Whether to compile list-items tightly.
[travis-badge]: https://img.shields.io/travis/wooorm/remark-toc.svg
## License
[travis]: https://travis-ci.org/wooorm/remark-toc
[MIT](LICENSE) © [Titus Wormer](http://wooorm.com)
[codecov-badge]: https://img.shields.io/codecov/c/github/wooorm/remark-toc.svg
[codecov]: https://codecov.io/github/wooorm/remark-toc
[npm-install]: https://docs.npmjs.com/cli/install
[releases]: https://github.com/wooorm/remark-toc/releases
[license]: LICENSE
[author]: http://wooorm.com
[remark]: https://github.com/wooorm/remark
[remark-slug]: https://github.com/wooorm/remark-slug
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc