Skip to content

the H5 and H6 in toc don't have the depth information #1292

@Benbinbin

Description

@Benbinbin

Is your feature request related to a problem? Please describe

I can get the more depth heading by setting the nuxt.config.ts

export default defineNuxtConfig({
  content: {
    markdown: {
      toc: {
        depth: 5,
        searchDepth: 5
      }
    }
  }
})

but the toc for h5 and h6 not the same as h1~h4, they don't has the depth information

Snipaste_2022-06-27_19-52-12

Describe the solution you'd like

maybe I can tell the level of the H5 or H6 depend on their parent level,

Describe alternatives you've considered

but I think also add the depth field for H5 and H6 can be more convenience for developers.

Additional context

the ProseH1, ProseH5 and ProseH6 also different, they don't wrap the <NuxtLink> component, for example the ProseH5.vue is

<template>
  <h5><slot /></h5>
</template>

but the ProseH2 ~ ProseH4 components can provide an anchor link, for example the ProseH2.vue is

<template>
  <h2 :id="id">
    <NuxtLink :href="`#${id}`">
      <slot />
    </NuxtLink>
  </h2>
</template>

<script setup lang="ts">
defineProps<{ id: string }>()
</script>

Sometimes a long blog post has the H5 or H6 level heading, but it can't provide the anchor link like other headings to click and navigate, it maybe confuse readers.

Although I can custom the Prose components for H5 and H6, but I think wrapping the <NuxtLink> component inside all the Heading Prose components maybe better.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions