Skip to content

About Footnotes in Markdown

· 1 min · markdown / footnote

By default, Astro adds an h2 heading called “Footnotes” when you use footnotes in Markdown/MDX. To remove it, you can update the generateToc like this:

src/utils/toc.ts
export function generateToc(
headings: readonly MarkdownHeading[],
minHeadingLevel: HeadingLevel,
maxHeadingLevel: HeadingLevel
) {
...
const bodyHeadings = headings.filter(
({ depth }) => depth >= minHeadingLevel && depth <= maxHeadingLevel
({ depth , text}) => depth >= minHeadingLevel && depth <= maxHeadingLevel && text !== 'Footnotes'
)
...
}

Or modify it to suit your needs.