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

markdown-toc

Package Overview
Dependencies
Maintainers
2
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

markdown-toc - npm Package Compare versions

Comparing version 0.12.5 to 0.12.6

2

cli.js

@@ -38,3 +38,3 @@ #!/usr/bin/env node

input.pipe(utils.concat(function (input) {
input.pipe(utils.concat(function(input) {
if (args.i) {

@@ -41,0 +41,0 @@ var newMarkdown = toc.insert(input.toString());

@@ -137,3 +137,3 @@ 'use strict';

}
if (ele.lvl > opts.maxdepth) {

@@ -146,3 +146,2 @@ continue;

}

@@ -187,3 +186,3 @@ return res.join('\n');

function _getSlug( tok, opts ) {
function _getSlug(tok, opts) {
var slug = slugify(tok.content, opts);

@@ -196,4 +195,2 @@ if (tok.seen > 0) {

/**

@@ -216,2 +213,3 @@ * Slugify the url part of a markdown link.

str = str.split('.').join('').toLowerCase();
str = str.split(':').join('');
str = str.split(' ').join('-');

@@ -274,2 +272,3 @@ str = str.split(/\t/).join('----');

toc.titleize = titleize;
toc.plugin = generate;
toc.strip = strip;
{
"name": "markdown-toc",
"description": "Generate a markdown TOC (table of contents) with Remarkable.",
"version": "0.12.5",
"version": "0.12.6",
"homepage": "https://github.com/jonschlinkert/markdown-toc",

@@ -15,5 +15,8 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)",

"index.js",
"lib/"
"lib"
],
"main": "index.js",
"bin": {
"markdown-toc": "cli.js"
},
"engines": {

@@ -25,5 +28,2 @@ "node": ">=0.10.0"

},
"bin": {
"markdown-toc": "cli.js"
},
"dependencies": {

@@ -91,3 +91,7 @@ "concat-stream": "^1.5.1",

"reflinks": [
"<%= related.list %>",
"gfm-code-blocks",
"markdown-link",
"markdown-utils",
"pretty-remarkable",
"remarkable",
"verb"

@@ -94,0 +98,0 @@ ],

@@ -1,4 +0,4 @@

# markdown-toc [![NPM version](https://img.shields.io/npm/v/markdown-toc.svg)](https://www.npmjs.com/package/markdown-toc) [![Build Status](https://img.shields.io/travis/jonschlinkert/markdown-toc.svg)](https://travis-ci.org/jonschlinkert/markdown-toc)
# markdown-toc [![NPM version](https://img.shields.io/npm/v/markdown-toc.svg?style=flat)](https://www.npmjs.com/package/markdown-toc) [![NPM downloads](https://img.shields.io/npm/dm/markdown-toc.svg?style=flat)](https://npmjs.org/package/markdown-toc) [![Build Status](https://img.shields.io/travis/jonschlinkert/markdown-toc.svg?style=flat)](https://travis-ci.org/jonschlinkert/markdown-toc)
> Generate a markdown TOC (table of contents) with Remarkable.
Generate a markdown TOC (table of contents) with Remarkable.

@@ -8,4 +8,6 @@ ## TOC

- [Install](#install)
- [Highights](#highights)
- [Usage](#usage)
- [API](#api)
- [toc.plugin](#tocplugin)
* [toc.json](#tocjson)

@@ -38,4 +40,7 @@ * [toc.insert](#tocinsert)

## Highights
**Features**
* Can optionally be used as a [remarkable](https://github.com/jonschlinkert/remarkable) plugin
* Returns an object with the rendered TOC (on `content`), as well as a `json` property with the raw TOC object, so you can generate your own TOC using templates or however you want

@@ -70,4 +75,31 @@ * Works with [repeated headings](https://gist.github.com/jonschlinkert/ac5d8122bfaaa394f896)

## API
## toc.plugin
Use as a [remarkable](https://github.com/jonschlinkert/remarkable) plugin.
```js
var Remarkable = require('remarkable');
var toc = require('markdown-toc');
function render(str, options) {
return new utils.Remarkable()
.use(toc.plugin(options)) // <= register the plugin
.render(str);
}
```
**Usage example**
```js
var results = render('# AAA\n# BBB\n# CCC\nfoo\nbar\nbaz');
```
Results in:
```markdown
- [AAA](#aaa)
- [BBB](#bbb)
- [CCC](#ccc)
```
### toc.json

@@ -226,2 +258,4 @@

You might also be interested in these projects:
* [gfm-code-blocks](https://www.npmjs.com/package/gfm-code-blocks): Extract gfm (GitHub Flavored Markdown) fenced code blocks from a string. | [homepage](https://github.com/jonschlinkert/gfm-code-blocks)

@@ -268,3 +302,3 @@ * [markdown-link](https://www.npmjs.com/package/markdown-link): Micro util for generating a single markdown link. | [homepage](https://github.com/jonschlinkert/markdown-link)

Copyright © 2016 [Jon Schlinkert](https://github.com/jonschlinkert)
Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT license](https://github.com/jonschlinkert/markdown-toc/blob/master/LICENSE).

@@ -274,2 +308,2 @@

_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on March 22, 2016._
_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on April 23, 2016._

Sorry, the diff of this file is not supported yet

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