Socket
Socket
Sign inDemoInstall

markdown-toc

Package Overview
Dependencies
53
Maintainers
2
Versions
47
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.1 to 1.0.2

14

index.js

@@ -47,3 +47,2 @@ 'use strict';

var opts = utils.merge({firsth1: true, maxdepth: 6}, options);
var seen = opts.seen = {};
var stripFirst = opts.firsth1 === false;

@@ -55,2 +54,3 @@ if (opts.linkify !== false) opts.linkify = true;

tokens = tokens.slice();
var seen = {};
var len = tokens.length, i = 0, num = 0;

@@ -97,3 +97,3 @@ var tocstart = -1;

tok.seen = seen[val];
tok.seen = opts.num = seen[val];
tok.slug = utils.slugify(val, opts);

@@ -184,9 +184,8 @@ res.json.push(utils.pick(tok, ['content', 'slug', 'lvl', 'i', 'seen']));

function linkify(tok, opts) {
function linkify(tok, options) {
var opts = utils.merge({}, options);
if (tok && tok.content) {
opts.num = tok.seen;
var text = titleize(tok.content, opts);
var slug = utils.slugify(tok.content, opts);
if (tok.seen) {
slug += '-' + tok.seen;
}
slug = querystring.escape(slug);

@@ -219,3 +218,4 @@ if (opts && typeof opts.linkify === 'function') {

str = str.split(/<\/?[^>]+>/).join('');
return str.replace(/[ \t]+/g, ' ').trim();
str = str.split(/[ \t]+/).join(' ');
return str.trim();
}

@@ -222,0 +222,0 @@

@@ -16,11 +16,11 @@ 'use strict';

require('concat-stream', 'concat');
require('gray-matter', 'matter');
require('list-item', 'li');
require('markdown-link', 'mdlink');
require('minimist');
require('mixin-deep', 'merge');
require('object.pick', 'pick');
require('remarkable', 'Remarkable');
require('repeat-string', 'repeat');
require('markdown-link', 'mdlink');
require('concat-stream', 'concat');
require('gray-matter', 'matter');
require('object.pick', 'pick');
require('mixin-deep', 'merge');
require('list-item', 'li');
require('strip-color');

@@ -62,3 +62,3 @@ require = fn;

// `.split()` is often (but not always) faster than `.replace()`
str = str.split(/ /).join('-');
str = str.split(' ').join('-');
str = str.split(/\t/).join('--');

@@ -69,2 +69,5 @@ str = str.split(/<\/?[^>]+>/).join('');

str = diacritics.removeDiacritics(str);
if (options.num) {
str += '-' + options.num;
}
return str;

@@ -71,0 +74,0 @@ };

{
"name": "markdown-toc",
"description": "Generate a markdown TOC (table of contents) with Remarkable.",
"version": "1.0.1",
"version": "1.0.2",
"homepage": "https://github.com/jonschlinkert/markdown-toc",

@@ -61,4 +61,3 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)",

"gulp-format-md": "^0.1.11",
"mocha": "^3.2.0",
"should": "^11.1.1"
"mocha": "^3.2.0"
},

@@ -65,0 +64,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc