Socket
Socket
Sign inDemoInstall

metalsmith-autotoc

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

metalsmith-autotoc - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

20

index.js

@@ -43,2 +43,7 @@

/**
* @param {Function} [options.slug]
* @param {String} [options.selector]
* @param {String} [options.headerIdPrefix]
*/
module.exports = function(options) {

@@ -48,11 +53,6 @@ options = options || {};

options.headerIdPrefix = options.headerIdPrefix || '';
options.slug = options.slug || function(innerHTML) {
return options.headerIdPrefix + slug(innerHTML);
};
function generateId(header) {
if (!header.id) {
return options.headerIdPrefix + slug(header.innerHTML);
} else {
return header.id;
}
}
function getRootLevel(headers) {

@@ -133,3 +133,5 @@ return headers.map(function(header) {

).map(function(header) {
header.id = generateId(header);
if (!header.id) {
header.id = options.slug(header.innerHTML);
}
return header;

@@ -136,0 +138,0 @@ });

{
"name": "metalsmith-autotoc",
"version": "0.1.0",
"version": "0.1.1",
"description": "A metalsmith plugin to generate table of contents of a document.",

@@ -5,0 +5,0 @@ "repository": "git@github.com:anatoo/metalsmith-autotoc.git",

@@ -36,12 +36,12 @@ # metalsmith-autotoc

---
<h2 id="aaa">aaa</h2>
<h2>aaa</h2>
<p>paragraph</p>
<h3 id="bbb">bbb</h3>
<h3>bbb</h3>
<p>paragraph</p>
<h3 id="ccc">ccc</h3>
<h3>ccc</h3>
<p>paragraph</p>
<h2 id="ddd">ddd</h2>
<h2>ddd</h2>
<p>paragraph</p>

@@ -48,0 +48,0 @@ ```

@@ -13,3 +13,2 @@ var assert = require('assert');

headerIdPrefix: 'foo-'
}))

@@ -16,0 +15,0 @@ .use(templates({

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