fix: handle empty heading text in TOC generation

pull/18314/head
GuanMu 12 months ago
parent e9cb9e8695
commit b9af8effab

@ -38,7 +38,7 @@ const useToc = (apiBaseUrl: string, locale: string) => {
const tocItems: TocItem[] = headingElementsArray.map((heading, index) => ({
href: `#section-${index}`,
text: (heading.textContent || `章节 ${index + 1}`).trim(),
text: (heading.textContent || '').trim(),
index,
}))

Loading…
Cancel
Save