--- import type { MarkdownHeading } from "astro"; import "../styles/toc.scss"; interface Props { toc: boolean; headings: MarkdownHeading[]; } const { toc, headings } = Astro.props; const minDepth = Math.min(...headings.map((heading) => heading.depth)); --- { toc ? ( <>

Table of contents

    {headings.map((heading) => { const depth = heading.depth - minDepth; const padding = 10 * Math.pow(0.85, depth); const fontSize = 14 * Math.pow(0.9, depth); return (
  • {heading.text}
  • ); })}
) : ( ) }