diff --git a/docs/lib/index.js b/docs/lib/index.js index 5f8501ead27b8..b88d20cca3558 100644 --- a/docs/lib/index.js +++ b/docs/lib/index.js @@ -157,7 +157,7 @@ const replaceHelpLinks = (src) => { const transformMan = (src, { data, unified, remarkParse, remarkMan }) => unified() .use(remarkParse) - .use(remarkMan) + .use(remarkMan, { version: `NPM@${version}` }) .processSync(`# ${data.title}(${data.section}) - ${data.description}\n\n${src}`) .toString() diff --git a/docs/lib/template.html b/docs/lib/template.html index be3bafd61aa05..622dc327046ee 100644 --- a/docs/lib/template.html +++ b/docs/lib/template.html @@ -115,6 +115,11 @@ line-height: 1; } +header.title .version { + font-size: 0.8em; + color: #666666; +} + footer#edit { border-top: solid 1px #e1e4e8; margin: 3em 0 4em 0; @@ -138,7 +143,10 @@
-

{{ title }}

+

+ {{ title }} + @{{ version }} +

{{ description }}
diff --git a/docs/lib/transform-html.js b/docs/lib/transform-html.js index c587d75e994f8..dc3dd4930d05d 100644 --- a/docs/lib/transform-html.js +++ b/docs/lib/transform-html.js @@ -1,4 +1,5 @@ const jsdom = require('jsdom') +const { version } = require('../../package.json') function transformHTML ( src, @@ -36,6 +37,9 @@ function transformHTML ( case 'config.github_path': return data[key.replace(/^config\./, '')] + case 'version': + return version + default: throw new Error(`warning: unknown token '${token}' in ${path}`) }