Describe the bug
When using [[toc]] to generate a table of contents in VitePress, headings (e.g., ## Heading) placed inside a :::details custom container are missing from the generated TOC list. However, the "On this page" sidebar on the right side correctly includes those headings.
在 VitePress 中使用 [[toc]] 生成页面目录时,发现如果某个标题(如 ## 标题)被包裹在 :::details 自定义容器内,则该标题不会出现在由 [[toc]] 生成的目录列表中。然而,页面右侧的“On this page”(本页结构)侧边栏却能正确包含该标题
# VitePress 💙 StackBlitz
[[toc]]
## foo
123
:::details
## bar
345
:::
Reproduction
https://stackblitz.com/edit/vite-w37rq9sf?file=docs%2Fexample.md
- Place
[[toc]] in a Markdown file.
- Put a heading inside a
:::details block, e.g.:
:::details Click to expand
## Wrapped heading
:::
- Build or preview the page and compare the TOC generated by
[[toc]] with the right sidebar.
- 在 Markdown 文件中使用
[[toc]]
- 在
:::details 块内放置一个标题,例如:
:::details 点击展开
## 被包裹的标题
:::
- 构建或预览页面,查看
[[toc]] 生成的目录和右侧侧边栏的差异
Expected behavior
[[toc]] should use the same heading extraction logic as the "On this page" sidebar, so it should also include headings inside details blocks.
[[toc]] 应与“On this page”侧边栏保持一致的标题提取逻辑,即同样包含 details 块内的标题
System Info
Vitepress: Latest (alpha.17 and .19)
OS: Windows 11 25H11
Additional context
Not sure if it was done on purpose
不确定是不是有意而为之
🤔
Validations
Describe the bug
When using
[[toc]]to generate a table of contents in VitePress, headings (e.g.,## Heading) placed inside a:::detailscustom container are missing from the generated TOC list. However, the "On this page" sidebar on the right side correctly includes those headings.在 VitePress 中使用
[[toc]]生成页面目录时,发现如果某个标题(如## 标题)被包裹在:::details自定义容器内,则该标题不会出现在由[[toc]]生成的目录列表中。然而,页面右侧的“On this page”(本页结构)侧边栏却能正确包含该标题Reproduction
https://stackblitz.com/edit/vite-w37rq9sf?file=docs%2Fexample.md
[[toc]]in a Markdown file.:::detailsblock, e.g.::::details Click to expand ## Wrapped heading :::[[toc]]with the right sidebar.[[toc]]:::details块内放置一个标题,例如::::details 点击展开 ## 被包裹的标题 :::[[toc]]生成的目录和右侧侧边栏的差异Expected behavior
[[toc]]should use the same heading extraction logic as the "On this page" sidebar, so it should also include headings insidedetailsblocks.[[toc]]应与“On this page”侧边栏保持一致的标题提取逻辑,即同样包含details块内的标题System Info
Additional context
Not sure if it was done on purpose
不确定是不是有意而为之
🤔
Validations