markdown-magic 3.3.3 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/utils/toc.js +9 -5
- package/package.json +2 -3
package/lib/utils/toc.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const { generateToc : generateTocUtils } = require('@davidwells/md-utils')
|
|
2
2
|
const { removeLeadingAndTrailingLineBreaks, escapeRegexString } = require('./regex')
|
|
3
3
|
const { findMinIndent } = require('./text')
|
|
4
4
|
const { readFile } = require('./fs')
|
|
@@ -75,8 +75,11 @@ async function generateToc({
|
|
|
75
75
|
// separator: '<span>|</span>',
|
|
76
76
|
// footer: 'end',
|
|
77
77
|
}
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
|
|
79
|
+
const tocObject = generateTocUtils(contents)
|
|
80
|
+
|
|
81
|
+
// let outputText = t.wrappedToc || ''
|
|
82
|
+
let outputText = tocObject.text || ''
|
|
80
83
|
|
|
81
84
|
if (debugFileMatch) {
|
|
82
85
|
console.log('before firsth1 removal', outputText)
|
|
@@ -247,7 +250,9 @@ async function generateToc({
|
|
|
247
250
|
// console.log('single', single)
|
|
248
251
|
const subItems = outputText.match(findSubToc)
|
|
249
252
|
if (subItems) {
|
|
250
|
-
const items = subItems[0]
|
|
253
|
+
const items = subItems[0]
|
|
254
|
+
.replace(single, '')
|
|
255
|
+
.split('\n')
|
|
251
256
|
.filter(Boolean)
|
|
252
257
|
// console.log('items', items)
|
|
253
258
|
const finalItems = items // .slice(1, items.length)
|
|
@@ -277,7 +282,6 @@ ${outputText
|
|
|
277
282
|
|
|
278
283
|
</details>`
|
|
279
284
|
}
|
|
280
|
-
|
|
281
285
|
return outputText.replace(removeLeadingAndTrailingLineBreaks, '')
|
|
282
286
|
}
|
|
283
287
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "markdown-magic",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.0",
|
|
4
4
|
"description": "Automatically update markdown files with content from external sources",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -43,8 +43,7 @@
|
|
|
43
43
|
"url": "https://github.com/DavidWells/markdown-magic"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@davidwells/md-utils": "^0.0.
|
|
47
|
-
"@technote-space/doctoc": "2.4.7",
|
|
46
|
+
"@davidwells/md-utils": "^0.0.44",
|
|
48
47
|
"globrex": "^0.1.2",
|
|
49
48
|
"gray-matter": "^4.0.3",
|
|
50
49
|
"is-glob": "^4.0.3",
|