From cee5001a4e31863156e1fc8f19d2520d8a021a23 Mon Sep 17 00:00:00 2001 From: Vincent Weevers Date: Sat, 31 Aug 2019 18:43:04 +0200 Subject: [PATCH] Allow disabling automatic table of contents --- cli.js | 1 + options.js | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/cli.js b/cli.js index 487ece6..adf3ff4 100644 --- a/cli.js +++ b/cli.js @@ -38,6 +38,7 @@ if (argv.help) { packageOpts.validateLinks = packageOpts.validateLinks !== false packageOpts.paddedTable = packageOpts.paddedTable !== false + packageOpts.toc = packageOpts.toc !== false deglob(glob, { usePackageJson: false, cwd, ignore }, function (err, files) { if (err) throw err diff --git a/options.js b/options.js index 8bab330..db574dc 100644 --- a/options.js +++ b/options.js @@ -34,14 +34,17 @@ module.exports = function (argv, packageOpts, files, cwd, repository) { // Skip updating contributors table in lint mode fix ? [require('remark-git-contributors'), { contributors }] : null, [require('remark-github'), { repository }], - [require('remark-toc'), { + + // TODO: https://github.com/vweevers/hallmark/issues/36 + packageOpts.toc ? [require('remark-toc'), { maxDepth: 2, tight: true - }], - [require('remark-collapse'), { + }] : null, + packageOpts.toc ? [require('remark-collapse'), { test: /^table of contents$/i, summary: 'Click to expand' - }], + }] : null, + require('./lint')(fix, cwd, packageOpts, repository) ].filter(Boolean), settings: {