Table of contents that includes more tags

<details>
  <summary>Table of contents</summary>
  {{ .Page.TableOfContents }}
</details>

I wrote that shortcode with the purpose of having a table of contents in each of the articles I write. However, many times I don’t just use headings like <h2> or <h3> but also h4 or <h5> at most, sometimes I also use tags like <dd> for a list with descriptions, is there a way for that shortcode to include those tags in the table of contents?

I think it’s related to the configuration, the TOC level range is 2-3 by default, see Configure Markup | Hugo.