mdast-util-toc
mdast-util-toc copied to clipboard
feature request: minDepth option
Initial checklist
- [X] I read the support docs
- [X] I read the contributing guide
- [X] I agree to follow the code of conduct
- [X] I searched issues and couldn’t find anything (or linked relevant results below)
Problem
I am trying to create a table of contents for h2s and h3s only. There is a maxDepth
option which enables me to ignore h4-h6 headings, but not a minDepth
option to ignore h1s.
In my document, the single h1 is the main title of the document, with subheadings in the h2-h6 range.
It makes sense to me that the table of contents not contain the h1.
Solution
Add a minDepth
option.
Alternatives
I could remove the h1 from the mdast
tree before passing it to toc(mdast)
.