@vuepress/markdown 1.7.1 → 1.8.3
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/index.js +2 -1
- package/lib/link.js +5 -5
- package/lib/snippet.js +1 -1
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -31,6 +31,7 @@ const {
|
|
|
31
31
|
module.exports = (markdown = {}) => {
|
|
32
32
|
const {
|
|
33
33
|
externalLinks,
|
|
34
|
+
pageSuffix,
|
|
34
35
|
anchor,
|
|
35
36
|
toc,
|
|
36
37
|
plugins,
|
|
@@ -73,7 +74,7 @@ module.exports = (markdown = {}) => {
|
|
|
73
74
|
.use(convertRouterLinkPlugin, [Object.assign({
|
|
74
75
|
target: '_blank',
|
|
75
76
|
rel: 'noopener noreferrer'
|
|
76
|
-
}, externalLinks)])
|
|
77
|
+
}, externalLinks), pageSuffix])
|
|
77
78
|
.end()
|
|
78
79
|
|
|
79
80
|
.plugin(PLUGINS.HOIST_SCRIPT_STYLE)
|
package/lib/link.js
CHANGED
|
@@ -6,7 +6,7 @@ const url = require('url')
|
|
|
6
6
|
|
|
7
7
|
const indexRE = /(^|.*\/)(index|readme).md(#?.*)$/i
|
|
8
8
|
|
|
9
|
-
module.exports = (md, externalAttrs) => {
|
|
9
|
+
module.exports = (md, externalAttrs, pageSuffix = '.html') => {
|
|
10
10
|
let hasOpenRouterLink = false
|
|
11
11
|
let hasOpenExternalLink = false
|
|
12
12
|
|
|
@@ -28,13 +28,13 @@ module.exports = (md, externalAttrs) => {
|
|
|
28
28
|
}
|
|
29
29
|
} else if (isSourceLink) {
|
|
30
30
|
hasOpenRouterLink = true
|
|
31
|
-
tokens[idx] = toRouterLink(token, link, relativePath)
|
|
31
|
+
tokens[idx] = toRouterLink(token, link, relativePath, pageSuffix)
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
return self.renderToken(tokens, idx, options)
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
function toRouterLink (token, link, relativePath) {
|
|
37
|
+
function toRouterLink (token, link, relativePath, suffix) {
|
|
38
38
|
link[0] = 'to'
|
|
39
39
|
let to = link[1]
|
|
40
40
|
|
|
@@ -55,8 +55,8 @@ module.exports = (md, externalAttrs) => {
|
|
|
55
55
|
to = path + hash
|
|
56
56
|
} else {
|
|
57
57
|
to = to
|
|
58
|
-
.replace(/\.md$/,
|
|
59
|
-
.replace(/\.md(#.*)$/,
|
|
58
|
+
.replace(/\.md$/, suffix)
|
|
59
|
+
.replace(/\.md(#.*)$/, `${suffix}$1`)
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
// markdown-it encodes the uri
|
package/lib/snippet.js
CHANGED
|
@@ -137,7 +137,7 @@ module.exports = function snippet (md, options = {}) {
|
|
|
137
137
|
*
|
|
138
138
|
* captures: ['/path/to/file.extension', 'extension', '#region', '{meta}']
|
|
139
139
|
*/
|
|
140
|
-
const rawPathRegexp = /^(
|
|
140
|
+
const rawPathRegexp = /^(.+?(?:\.([a-z]+))?)(?:(#[\w-]+))?(?: ?({\d+(?:[,-]\d+)*}))?$/
|
|
141
141
|
|
|
142
142
|
const rawPath = state.src.slice(start, end).trim().replace(/^@/, root).trim()
|
|
143
143
|
const [filename = '', extension = '', region = '', meta = ''] = (rawPathRegexp.exec(rawPath) || []).slice(1)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vuepress/markdown",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.3",
|
|
4
4
|
"description": "markdown for vuepress",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"documentation",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"author": "Evan You",
|
|
23
23
|
"main": "index.js",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@vuepress/shared-utils": "1.
|
|
25
|
+
"@vuepress/shared-utils": "1.8.3",
|
|
26
26
|
"markdown-it": "^8.4.1",
|
|
27
27
|
"markdown-it-anchor": "^5.0.2",
|
|
28
28
|
"markdown-it-chain": "^1.3.0",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"email": "chl814@foxmail.com"
|
|
40
40
|
}
|
|
41
41
|
],
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "469b33fc781edbc4dfd1b4dc56a71c76188a521f"
|
|
43
43
|
}
|