mdast-util-toc icon indicating copy to clipboard operation
mdast-util-toc copied to clipboard

feature request: minDepth option

Open dmca-glasgow opened this issue 9 months ago • 4 comments

Initial checklist

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).

dmca-glasgow avatar May 28 '24 15:05 dmca-glasgow