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 2.0.1 to 2.1.0

7

history.md

@@ -5,2 +5,9 @@ <!--remark setext-->

2.1.0 / 2018-08-01
==================
* use existing ids ([#34](https://github.com/BarryThePenguin/mdast-util-toc/pull/34))
* update to node 10 in `.travis.yml` ([#35](https://github.com/BarryThePenguin/mdast-util-toc/pull/35))
* bump devDependencies
2.0.1 / 2016-07-23

@@ -7,0 +14,0 @@ ==================

2

index.js

@@ -12,2 +12,2 @@ /**

/* Expose. */
module.exports = require('./lib/index.js');
module.exports = require('./lib');

@@ -34,3 +34,4 @@ /**

if (!heading) {
result.index = result.endIndex = null;
result.index = null;
result.endIndex = null;
}

@@ -37,0 +38,0 @@

@@ -24,9 +24,9 @@ /**

/**
* Insert a `node` into a `parent`.
*
* @param {Object} node - `node` to insert.
* @param {Object} parent - Parent of `node`.
* @param {boolean?} [tight] - Prefer tight list-items.
* @return {undefined}
*/
* Insert a `node` into a `parent`.
*
* @param {Object} node - `node` to insert.
* @param {Object} parent - Parent of `node`.
* @param {boolean?} [tight] - Prefer tight list-items.
* @return {undefined}
*/
function insert(node, parent, tight) {

@@ -45,11 +45,15 @@ var children = parent.children;

type: PARAGRAPH,
children: [{
type: LINK,
title: null,
url: '#' + node.id,
children: [{
type: TEXT,
value: node.value
}]
}]
children: [
{
type: LINK,
title: null,
url: '#' + node.id,
children: [
{
type: TEXT,
value: node.value
}
]
}
]
});

@@ -56,0 +60,0 @@

@@ -27,4 +27,8 @@ /**

function isOpeningHeading(node, depth, expression) {
return depth === null && node && node.type === HEADING &&
expression.test(toString(node));
return (
depth === null &&
node &&
node.type === HEADING &&
expression.test(toString(node))
);
}

@@ -16,6 +16,6 @@ /**

/**
* Create a list item.
*
* @return {Object} - List-item node.
*/
* Create a list item.
*
* @return {Object} - List-item node.
*/
function listItem() {

@@ -22,0 +22,0 @@ return {

@@ -16,6 +16,6 @@ /**

/**
* Create a list.
*
* @return {Object} - List node.
*/
* Create a list.
*
* @return {Object} - List node.
*/
function list() {

@@ -22,0 +22,0 @@ return {

@@ -51,5 +51,7 @@ /**

visit(root, HEADING, function (child, index, parent) {
visit(root, HEADING, function(child, index, parent) {
var value = toString(child);
var id = slugs.slug(value);
var id =
child.data && child.data.hProperties && child.data.hProperties.id;
id = slugs.slug(id || value);

@@ -86,3 +88,4 @@ if (parent !== root) {

if (headingIndex === undefined) {
headingIndex = closingIndex = -1;
headingIndex = -1;
closingIndex = -1;
map = [];

@@ -89,0 +92,0 @@ }

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

@@ -11,7 +11,7 @@ "main": "index.js",

"scripts": {
"build-md": "remark . --quiet --frail",
"build-md": "remark . --quiet --frail --output",
"build-bundle": "browserify index.js --no-builtins -s mdastUtilTOC > mdast-util-toc.js",
"build-mangle": "esmangle mdast-util-toc.js > mdast-util-toc.min.js",
"build": "npm run build-md && npm run build-bundle && npm run build-mangle",
"lint": "xo index.js test",
"lint": "xo",
"test-api": "node test/index.js",

@@ -43,19 +43,24 @@ "test-coverage": "istanbul cover test/index.js",

"devDependencies": {
"browserify": "^13.0.1",
"browserify": "^16.2.1",
"esmangle": "^1.0.1",
"istanbul": "^0.4.4",
"remark": "^6.2.0",
"remark-cli": "^2.1.0",
"remark-comment-config": "^4.0.1",
"remark-github": "^6.0.0",
"remark-lint": "^5.4.0",
"remark-parse": "^2.2.0",
"remark-stringify": "^2.3.0",
"remark-usage": "^4.0.0",
"remark-validate-links": "^5.0.0",
"remark-attr": "^0.6.2",
"remark": "^9.0.0",
"remark-cli": "^5.0.0",
"remark-comment-config": "^5.0.0",
"remark-github": "^7.0.0",
"remark-preset-lint-consistent": "^2.0.0",
"remark-preset-lint-recommended": "^3.0.0",
"remark-usage": "^6.0.0",
"remark-validate-links": "^7.0.0",
"tape": "^4.6.0",
"xo": "^0.16.0"
"xo": "^0.21.1"
},
"xo": {
"space": 4,
"esnext": false,
"prettier": true,
"ignore": [
"example.js"
],
"rules": {

@@ -62,0 +67,0 @@ "valid-jsdoc": [

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