Skip to content

Commit 6700bfa

Browse files
isaacsruyadorno
authored andcommitted
doc: fix hyperlink refs in man page docs
PR-URL: #283 Credit: @isaacs Close: #283 Reviewed-by: @ruyadorno
1 parent d3c8598 commit 6700bfa

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

scripts/docs-build.js

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,17 @@ var dest = args[1] || src
1010
fs.readFile(src, 'utf8', function (err, data) {
1111
if (err) return console.log(err)
1212

13-
var fileExt = src.split('.').pop()
1413
var result = data.replace(/@VERSION@/g, npm.version)
14+
.replace(/---([\s\S]+)---/g, '')
15+
.replace(/(npm-)?([a-zA-Z\\.-]*)\(1\)/g, 'npm help $2')
16+
.replace(/(npm-)?([a-zA-Z\\.-]*)\((5|7)\)/g, 'npm help $2')
17+
.replace(/npm(1)/g, 'npm help npm')
18+
.replace(/\[([^\]]+)\]\(\/cli-commands\/([^)]+)\)/g, 'npm help $2')
19+
.replace(/\[([^\]]+)\]\(\/configuring-npm\/([^)]+)\)/g, 'npm help $2')
20+
.replace(/\[([^\]]+)\]\(\/using-npm\/([^)]+)\)/g, 'npm help $2')
21+
.trim()
1522

16-
if (fileExt === 'md') {
17-
result = marked(
18-
result.replace(/---([\s\S]+)---/g, '')
19-
.replace(/(npm-)?([a-zA-Z\\.-]*)\(1\)/g, 'npm help $2')
20-
.replace(/(npm-)?([a-zA-Z\\.-]*)\((5|7)\)/g, 'npm help $2')
21-
.replace(/(npm-)?([a-zA-Z\\.-]*)\(3\)/g, 'npm apihelp $2')
22-
.replace(/npm(1)/g, 'npm help npm')
23-
.replace(/npm(3)/g, 'npm apihelp npm')
24-
.trim()
25-
)
26-
}
27-
28-
fs.writeFile(dest, result, 'utf8', function (err) {
23+
fs.writeFile(dest, marked(result), 'utf8', function (err) {
2924
if (err) return console.log(err)
3025
})
3126
})

0 commit comments

Comments
 (0)