Skip to content

Invalid setting toc.depth. #3630

@longmaobure

Description

@longmaobure

Environment

Operating System: Windows11
Node Version: v20.19.0
Nuxt Version: 4.2.1
Builder: -
User Config: experimental, devtools, compatibilityDate, modules, runtimeConfig, css, icon, vite, fonts, routeRules, app, schemaOrg, image, content
Runtime Modules: '@pinia/nuxt^0.11.3', '@nuxt/eslint^1.10.0', '@nuxtjs/tailwindcss^6.14.0', '@nuxt/content^3.8.2'

Version

v3

Reproduction

https://content.nuxt.com/docs/getting-started/configuration#markdown

Description

When I set content.build.markdown.toc.depth in the configuration file of nuxt.config.ts, it didn't work as expected.
I expected that when I set it, I should return the h1 tag to me, but it didn't.

Additional context

Image
// nuxt.config.js
export default defineNuxtConfig({
  compatibilityDate: '2025-07-15',
  devtools: { enabled: true },
  app: {
    head: {
      title: '我的 Nuxt 博客',
      meta: [{ name: 'description', content: '这是一个 Nuxt4 博客示例' }]
    }
  },
  // components: [
  //   {
  //     path: '~/components/articles',
  //     pathPrefix: false
  //   }
  // ],
  // modules: ['@pinia/nuxt', '@nuxt/eslint', '@nuxtjs/tailwindcss'],
  modules: ['@pinia/nuxt', '@nuxt/eslint', '@nuxtjs/tailwindcss', '@nuxt/content'],
  css: ['@/assets/css/tailwind.css'],
  pinia: {
    storesDirs: ['./app/stores/**']
  },
  content: {
    build: {
      markdown: {
        toc: {
          depth: 1,
          searchDepth: 1
        }
      }
    },
    highlight: {
      theme: 'github-light', // 可以换 "github-light", "nord", "dracula"
      preload: ['ts', 'js', 'vue', 'json', 'html', 'css']
    }
  }
});

Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions