diff options
author | claudiahdz <cghr1990@gmail.com> | 2019-11-06 21:06:36 +0300 |
---|---|---|
committer | claudiahdz <cghr1990@gmail.com> | 2019-11-14 20:11:49 +0300 |
commit | b8c1576a448566397c721655b95fc90bf202b35a (patch) | |
tree | dc6adfef512c2086aa7f61d7b7d0eb3e48e86ef3 /scripts | |
parent | 3471d5200217bfa612b1a262e36c9c043a52eb09 (diff) |
chore(docs): fix links on markdowns
chore(docs): fix styling issues on man and html docs
chore(docs): fix absolute links on cli docs
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/docs-build.js | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/scripts/docs-build.js b/scripts/docs-build.js index f6b87ae9d..e3cd2e982 100644 --- a/scripts/docs-build.js +++ b/scripts/docs-build.js @@ -10,14 +10,16 @@ var dest = args[1] || src fs.readFile(src, 'utf8', function (err, data) { if (err) return console.log(err) + function replacer (match, p1) { + return 'npm help ' + p1.replace(/npm /, '') + } + var result = data.replace(/@VERSION@/g, npm.version) .replace(/---([\s\S]+)---/g, '') - .replace(/(npm-)?([a-zA-Z\\.-]*)\(1\)/g, 'npm help $2') - .replace(/(npm-)?([a-zA-Z\\.-]*)\((5|7)\)/g, 'npm help $2') - .replace(/npm(1)/g, 'npm help npm') - .replace(/\[([^\]]+)\]\(\/cli-commands\/([^)]+)\)/g, 'npm help $2') - .replace(/\[([^\]]+)\]\(\/configuring-npm\/([^)]+)\)/g, 'npm help $2') - .replace(/\[([^\]]+)\]\(\/using-npm\/([^)]+)\)/g, 'npm help $2') + .replace(/\[([^\]]+)\]\(\/cli-commands\/([^)]+)\)/g, replacer) + .replace(/\[([^\]]+)\]\(\/configuring-npm\/([^)]+)\)/g, replacer) + .replace(/\[([^\]]+)\]\(\/using-npm\/([^)]+)\)/g, replacer) + .replace(/(# .*)\s+(## (.*))/g, '$1 - $3') .trim() fs.writeFile(dest, marked(result), 'utf8', function (err) { |