Skip to content

Adding markdown-toc-max-depth #1215

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions declarations/comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type DocumentationConfig = {
parseExtension: Array<string>,
noReferenceLinks?: boolean,
markdownToc?: boolean,
markdownTocMaxDepth?: number,
documentExported?: boolean,
resolve?: string,
hljs?: Object
Expand Down
2 changes: 2 additions & 0 deletions docs/USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ Options:
they change [boolean]
--markdown-toc include a table of contents in markdown output
[boolean] [default: true]
--markdown-toc-max-depth specifies the max depth of the table of contents in markdown output
[number] [default: 6]
--shallow shallow mode turns off dependency resolution, only
processing the specified files (or the main script
specified in package.json)
Expand Down
6 changes: 6 additions & 0 deletions src/commands/shared_options.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,5 +123,11 @@ module.exports.sharedOutputOptions = {
describe: 'include a table of contents in markdown output',
default: true,
type: 'boolean'
},
'markdown-toc-max-depth': {
describe:
'specifies the max depth of the table of contents in markdown output',
default: 6,
type: 'number'
}
};
6 changes: 5 additions & 1 deletion src/output/markdown_ast.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,11 @@ function buildMarkdownAST(comments, config) {
);

const pluginRemark = remark();
if (config.markdownToc) pluginRemark.use(toc, { tight: true });
if (config.markdownToc)
pluginRemark.use(toc, {
tight: true,
maxDepth: config.markdownTocMaxDepth
});
if (config.noReferenceLinks !== true) pluginRemark.use(links);
root = pluginRemark.run(root);

Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy