Skip to content

Commit dd9c03a

Browse files
committed
refactor(args): Improve the way we use yargs to simplify the markdown-toc option
1 parent 5bfc660 commit dd9c03a

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

lib/commands/build.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ module.exports.builder = extend({},
2626
default: 'json',
2727
choices: ['json', 'md', 'remark', 'html']
2828
},
29-
'no-markdown-toc': {
29+
'markdown-toc': {
3030
describe: 'include a table of contents in markdown output',
31-
default: 'stdout',
31+
default: true,
3232
type: 'boolean'
3333
},
3434
output: {
@@ -69,7 +69,7 @@ module.exports.handler = function build(argv, callback) {
6969
version: argv['project-version'] || (argv.package || {}).version,
7070
theme: argv.theme,
7171
paths: argv.paths,
72-
'no-markdown-toc': argv['no-markdown-toc'],
72+
markdownToc: argv.markdownToc,
7373
hljs: argv.hljs || {}
7474
};
7575

lib/output/markdown_ast.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ function markdownAST(comments, options, callback) {
210210

211211
var root = rerouteLinks(linkerStack.link,
212212
u('root', generatorComment
213-
.concat(options['no-markdown-toc'] ? [] : tableOfContentsHeading)
213+
.concat(options.markdownToc ? tableOfContentsHeading : [])
214214
.concat(comments.reduce(function (memo, comment) {
215215
return memo.concat(generate(2, comment));
216216
}, []))));

test/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ test('outputs', function (ttt) {
157157

158158
if (file.match(/es6.input.js/)) {
159159
tt.test('no markdown TOC', function (t) {
160-
outputMarkdown(_.cloneDeep(result), { 'no-markdown-toc': true }, function (err, result) {
160+
outputMarkdown(_.cloneDeep(result), { markdownToc: false }, function (err, result) {
161161
t.ifError(err);
162162
var outputfile = file.replace('.input.js', '.output-toc.md');
163163
if (UPDATE) {

0 commit comments

Comments
 (0)