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

bit-docs-html-toc

Package Overview
Dependencies
Maintainers
3
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bit-docs-html-toc - npm Package Compare versions

Comparing version 0.3.0 to 0.4.0

2

package.json
{
"name": "bit-docs-html-toc",
"version": "0.3.0",
"version": "0.4.0",
"description": "table of contents bit-docs plugin",

@@ -5,0 +5,0 @@ "main": "toc.js",

@@ -23,2 +23,9 @@ var stache = require("can-stache");

function makeAnchorHeadingId(anchorText) {
return (anchorText || "")
.replace(/\s/g, "-") // replace spaces with dashes
.replace(/[^\w\-]/g, "") // remove punctuation
.toLowerCase();
}
function outerHeight(el) {

@@ -102,5 +109,13 @@ var height = el.offsetHeight;

var navHeight = this.navHeight;
return [].map.call(titles, function(title, idx){
var headings = {};
return [].map.call(titles, function(title, idx) {
var txt = title.textContent;
title.id = 'section_' + txt.replace(/\s/g,"").replace(/[^\w]/g,"_");
var id = makeAnchorHeadingId(txt);
var count = headings[id] || 0;
// add unique id if we get headings with the same text
title.id = makeAnchorHeadingId(txt) + (count > 0 ? "-" + count : "");
headings[id] = count + 1;
return {

@@ -107,0 +122,0 @@ id: title.id,

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