Skip to content

Commit

Permalink
fix(theme): allow using h1 headings in outline
Browse files Browse the repository at this point in the history
closes #1529
  • Loading branch information
brc-dd committed Aug 4, 2023
1 parent ce85726 commit e3f8fc7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion __tests__/e2e/frontmatter/multiple-levels-outline.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Multiple Levels Outline
editLink: true
outline: 'deep'
outline: deep
---

# h1 - 1
Expand Down
4 changes: 3 additions & 1 deletion src/client/theme-default/composables/outline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ export function resolveTitle(theme: DefaultTheme.Config) {
}

export function getHeaders(range: DefaultTheme.Config['outline']) {
const headers = [...document.querySelectorAll('.VPDoc h2,h3,h4,h5,h6')]
const headers = [
...document.querySelectorAll('.VPDoc :where(h1,h2,h3,h4,h5,h6)')
]
.filter((el) => el.id && el.hasChildNodes())
.map((el) => {
const level = Number(el.tagName[1])
Expand Down

0 comments on commit e3f8fc7

Please sign in to comment.