You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, typedoc-plugin-remark requires that at least two## headings exist on the page in order for a Contents section to be added where remark-toc will add the table of contents.
In some cases, a type/interface may have lots of properties but only one (1) ## heading. It would be helpful to have a TOC in this case but its not currently possible.
In the repro, only one (1) ## heading exists so there is no TOC for the interface.
Would like to see an option added to control the "min" number of headings that must exist:
undefined = 2 or more (current behavior)
false = never add
true = always add
number = number of ## greater than equal to number (note that a value of 0 is the same as true)
Or more simply, could just be number with a default value of 2 to maintain current behavior. Also, not sure a never is really needed since it also checks for remark-toc and if it is there, can't think of a reason why Content heading shouldn't generate if number is met.
Happy to work on a PR for this if there is an appetite for it.
The text was updated successfully, but these errors were encountered:
For reasons describe in #743 the min number of headings count in itself might not be the way to go. Or perhaps introduce when there is at least one h2 heading other than a "Defined In" h2 I am not too sure (there is more context in the linked issue).
One thing this has brought to light is the for interfaces there is no "Defined In" h2, whereby there is for type aliases, functions etc which is not consistent. I think this is actually another bug as there should be an overall source link for the interface itself - would you agree?
Regarding the Defined in h2, I noticed that as well, just didn't have time to log an issue for it yet. Just created #746 so there's something official tracking it.
Regarding heading counts, etc. since this issue and #743 are kind of blending together and are closely related to begin with, might be easier to keep the convo in one-place so I'll add my further thoughts there.
What package is the feature request related to?
typedoc-plugin-markdown
Background
Currently, typedoc-plugin-remark requires that at least two
##
headings exist on the page in order for aContents
section to be added whereremark-toc
will add the table of contents.In some cases, a type/interface may have lots of properties but only one (1)
##
heading. It would be helpful to have a TOC in this case but its not currently possible.In the repro, only one (1)
##
heading exists so there is no TOC for the interface.Repro: https://stackblitz.com/edit/vitejs-vite-ifb3xfoh?file=src%2Findex.ts
Proposed solution
Would like to see an option added to control the "min" number of headings that must exist:
##
greater than equal to number (note that a value of 0 is the same astrue
)Or more simply, could just be
number
with a default value of2
to maintain current behavior. Also, not sure anever
is really needed since it also checks forremark-toc
and if it is there, can't think of a reason whyContent
heading shouldn't generate ifnumber
is met.Happy to work on a PR for this if there is an appetite for it.
The text was updated successfully, but these errors were encountered: