--- import type { MarkdownHeading } from "astro"; import TocList from "@components/atoms/blog/TocList.astro"; import WidgetLayout from "./WidgetLayout.astro"; import I18nKey from "@i18n/i18nKey"; import { i18n } from "@i18n/translation"; import { siteConfig } from "@/config/siteConfig"; interface Props { headings?: MarkdownHeading[]; class?: string; style?: string; widget?: unknown; } const { headings = [], class: className, style } = Astro.props; const removeTailingHash = (text: string) => { const lastIndexOfHash = text.lastIndexOf("#"); if (lastIndexOfHash !== text.length - 1) { return text; } return text.substring(0, lastIndexOfHash); }; const maxLevel = siteConfig.toc.depth; const tocHeadings = headings.map((heading) => ({ depth: heading.depth, text: removeTailingHash(heading.text), slug: heading.slug, })); ---