Comparing version 0.5.3 to 0.6.0
@@ -5,3 +5,4 @@ 'use strict'; | ||
, anchor = require('anchor-markdown-header') | ||
, updateSection = require('update-section'); | ||
, updateSection = require('update-section') | ||
, getHtmlHeaders = require('./get-html-headers'); | ||
@@ -29,3 +30,4 @@ var start = '<!-- START doctoc generated TOC please keep comment here to allow auto update -->\n' + | ||
function getHashedHeaders (lines) { | ||
var inCodeBlock = false; | ||
var inCodeBlock = false | ||
, lineno = 0; | ||
@@ -39,4 +41,7 @@ // Turn all headers into '## xxx' even if they were '## xxx ##' | ||
return lines | ||
.map(function (x, idx) { | ||
return { lineno: idx, line: x } | ||
}) | ||
.filter(function (x) { | ||
if (x.match(/^```/)) { | ||
if (x.line.match(/^```/)) { | ||
inCodeBlock = !inCodeBlock; | ||
@@ -46,4 +51,4 @@ } | ||
}) | ||
.map(function (x, index) { | ||
var match = /^(\#{1,8})[ ]*(.+)\r?$/.exec(x); | ||
.map(function (x) { | ||
var match = /^(\#{1,8})[ ]*(.+)\r?$/.exec(x.line); | ||
@@ -53,3 +58,3 @@ return match | ||
, name : normalize(match[2]) | ||
, line : index | ||
, line : x.lineno | ||
} | ||
@@ -124,3 +129,5 @@ : null; | ||
var headers = getHashedHeaders(linesToToc).concat(getUnderlinedHeaders(linesToToc)); | ||
var headers = getHashedHeaders(linesToToc) | ||
.concat(getUnderlinedHeaders(linesToToc)) | ||
.concat(getHtmlHeaders(linesToToc)) | ||
@@ -137,3 +144,2 @@ headers.sort(function (a, b) { | ||
var toc = | ||
@@ -140,0 +146,0 @@ '**Table of Contents** *generated with [DocToc](http://doctoc.herokuapp.com/)*' |
@@ -5,3 +5,3 @@ { | ||
"description": "Generates TOC for markdown files of local git repo.", | ||
"version": "0.5.3", | ||
"version": "0.6.0", | ||
"repository": { | ||
@@ -22,6 +22,7 @@ "type": "git", | ||
"anchor-markdown-header": "~0.3.0", | ||
"update-section": "^0.3.0" | ||
"htmlparser2": "~3.7.1", | ||
"update-section": "~0.3.0" | ||
}, | ||
"devDependencies": { | ||
"tap": "^0.4.8" | ||
"tap": "~0.4.8" | ||
}, | ||
@@ -28,0 +29,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
26995
12
528
0
4
4
+ Addedhtmlparser2@~3.7.1
+ Addedcore-util-is@1.0.3(transitive)
+ Addeddom-serializer@0.2.2(transitive)
+ Addeddomelementtype@1.3.12.3.0(transitive)
+ Addeddomhandler@2.2.1(transitive)
+ Addeddomutils@1.5.1(transitive)
+ Addedentities@1.0.02.2.0(transitive)
+ Addedhtmlparser2@3.7.3(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedisarray@0.0.1(transitive)
+ Addedreadable-stream@1.1.14(transitive)
+ Addedstring_decoder@0.10.31(transitive)
Updatedupdate-section@~0.3.0