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

mdast-util-toc

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mdast-util-toc - npm Package Compare versions

Comparing version 4.1.3 to 4.2.0

lib/to-expression.js

6

lib/index.js

@@ -7,2 +7,3 @@ 'use strict'

var contents = require('./contents')
var toExpression = require('./to-expression')

@@ -27,6 +28,1 @@ // Get a TOC representation of `node`.

}
// Transform a string into an applicable expression.
function toExpression(value) {
return new RegExp('^(' + value + ')$', 'i')
}

@@ -9,2 +9,3 @@ 'use strict'

var slugs = require('github-slugger')()
var toExpression = require('./to-expression')

@@ -19,2 +20,3 @@ var heading = convert('heading')

var maxDepth = settings.maxDepth || 6
var skip = settings.skip ? toExpression(settings.skip) : null
var parents = convert(settings.parents || root)

@@ -67,3 +69,8 @@ var map = []

if (!lookingForToc && value && child.depth <= maxDepth) {
if (
!lookingForToc &&
value &&
child.depth <= maxDepth &&
(!skip || !skip.test(value))
) {
map.push({

@@ -70,0 +77,0 @@ depth: child.depth,

{
"name": "mdast-util-toc",
"version": "4.1.3",
"version": "4.2.0",
"description": "Generate a Table of Contents (TOC) from a given Markdown file",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -96,2 +96,9 @@ # mdast-util-toc

###### `options.skip`
Headings to skip (`string`, optional), wrapped in
`new RegExp('^(' + value + ')$', 'i')`.
Any heading matching this expression will not be present in the table of
contents.
###### `options.tight`

@@ -98,0 +105,0 @@

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