fix(theme): allow using h1 headings in outline

closes #1529
pull/2733/head
Divyansh Singh 1 year ago
parent ce85726c12
commit e3f8fc7972

@ -1,7 +1,7 @@
--- ---
title: Multiple Levels Outline title: Multiple Levels Outline
editLink: true editLink: true
outline: 'deep' outline: deep
--- ---
# h1 - 1 # h1 - 1

@ -22,7 +22,9 @@ export function resolveTitle(theme: DefaultTheme.Config) {
} }
export function getHeaders(range: DefaultTheme.Config['outline']) { 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()) .filter((el) => el.id && el.hasChildNodes())
.map((el) => { .map((el) => {
const level = Number(el.tagName[1]) const level = Number(el.tagName[1])

Loading…
Cancel
Save