Skip to content

Commit e3f8fc7

Browse files
committedAug 4, 2023
fix(theme): allow using h1 headings in outline
closes #1529
1 parent ce85726 commit e3f8fc7

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed
 

‎__tests__/e2e/frontmatter/multiple-levels-outline.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Multiple Levels Outline
33
editLink: true
4-
outline: 'deep'
4+
outline: deep
55
---
66

77
# h1 - 1

‎src/client/theme-default/composables/outline.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ export function resolveTitle(theme: DefaultTheme.Config) {
2222
}
2323

2424
export function getHeaders(range: DefaultTheme.Config['outline']) {
25-
const headers = [...document.querySelectorAll('.VPDoc h2,h3,h4,h5,h6')]
25+
const headers = [
26+
...document.querySelectorAll('.VPDoc :where(h1,h2,h3,h4,h5,h6)')
27+
]
2628
.filter((el) => el.id && el.hasChildNodes())
2729
.map((el) => {
2830
const level = Number(el.tagName[1])

0 commit comments

Comments
 (0)
Please sign in to comment.