Add table of contents to docs

This commit is contained in:
Chris Clark
2015-11-19 10:37:08 -08:00
parent f7f2de291f
commit 5fb8d9214f
6 changed files with 73 additions and 8 deletions

View File

@@ -1,6 +1,7 @@
'use strict';
const fs = require('fs');
const path = require('path');
const execSync = require('child_process').execSync;
const ejs = require('ejs');
const renderFromPaths =
require('json-schema-to-markdown-table').renderFromPaths;
@@ -39,9 +40,9 @@ function main() {
console.error(error);
process.exit(1);
} else {
const outputPath = process.argv.length > 2 ? process.argv[2] :
path.join(ROOT, 'docs', 'index.md');
const outputPath = path.join(ROOT, 'docs', 'index.md');
fs.writeFileSync(outputPath, output);
execSync('npm run doctoc', {cwd: ROOT});
process.exit(0);
}
});

View File

@@ -37,7 +37,10 @@ integrationtest() {
}
doctest() {
node --harmony scripts/build_docs.js docs/index.md.test
mv docs/index.md docs/index.md.save
npm run docgen
mv docs/index.md docs/index.md.test
mv docs/index.md.save docs/index.md
cmp docs/index.md docs/index.md.test
rm docs/index.md.test
}