import type { Heading } from "$lib/wikilink"; import { A } from "@solidjs/router"; import type { Component } from "solid-js"; import { For, Show } from "solid-js"; type OutlinePanelProps = { headings: Heading[]; onHeadingClick?: (id: string) => void }; /** * Table of contents panel showing document outline from markdown headings */ export const OutlinePanel: Component = (props) => { const handleClick = (id: string, e: MouseEvent) => { e.preventDefault(); props.onHeadingClick?.(id); const element = document.getElementById(id); if (element) { element.scrollIntoView({ behavior: "smooth", block: "start" }); } }; return (

Outline

0} fallback={

No headings found

}>
); }; export default OutlinePanel;