/
githubmirror
/
bootstrap
Обзор
Документация
Войти
/
githubmirror
/
bootstrap
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
site/src/components/TableOfContents.astro
26 строк
519 B
Julien Déramond
Docs: migration from Hugo to Astro (#41251)
15 апр 2025, 19:37
Не верифицирован
15 апр 2025, 19:37
a8ab199
Код
Авторство
О чём код?
--- import type { MarkdownHeading } from 'astro' import { generateToc, type TocEntry } from '@libs/toc' interface Props { headings?: MarkdownHeading[] entries?: TocEntry[] } const { entries, headings } = Astro.props const toc = entries ? entries : generateToc(headings ?? []) --- <ul> { toc.map(({ children, slug, text }) => { return ( <li> <a href={`#${slug}`}>{text}</a> {children.length > 0 && <Astro.self entries={children} />} </li> ) }) } </ul>