Closed
Description
Initial checklist
- I read the support docsI read the contributing guideI agree to follow the code of conductI 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)
.
Activity
[-]minDepth option[/-][+]feature request: minDepth option[/+]wooorm commentedon May 28, 2024
Can you make this idea practical with a realistic input/actual/expected example?
dmca-glasgow commentedon May 29, 2024
Sure, given the following example:
The output is:
What I'm hoping to achieve is:
Thanks.
wooorm commentedon May 29, 2024
Right, right. Yeah, I think this makes sense. Want to work on a PR?
github-actions commentedon May 29, 2024
minDepth
#75Add `minDepth`
github-actions commentedon Jun 2, 2024
wooorm commentedon Jun 2, 2024
Done in
7.1.0
. Thank you!