--- import { buildHeadingId } from '../../lib/blog-helpers.ts' import * as interfaces from '../../lib/interfaces.ts' import { snakeToKebab } from '../../lib/style-helpers.ts' import '../../styles/notion-color.css' export interface Props { block: interfaces.Block headings: interfaces.Block[] } const { block, headings }: Props = Astro.props if (!block.TableOfContents) { return null } ---
{ headings.map((headingBlock: interfaces.Block) => { const heading = headingBlock.Heading1 || headingBlock.Heading2 || headingBlock.Heading3 if (!heading) return null let indentClass = '' if (headingBlock.Type === 'heading_2') { indentClass = 'indent-1' } else if (headingBlock.Type === 'heading_3') { indentClass = 'indent-2' } return ( {heading.RichTexts.map( (richText: interfaces.RichText) => richText.PlainText, ).join('')} ) }) }