import { type Component, createMemo, type ParentComponent, type JSXElement, createSignal, Show, onMount, } from "solid-js"; /* * Code from andii.dev */ const P: ParentComponent = (props) =>

{props.children}

; const Ol: ParentComponent = (props) => (
    {props.children}
); const Ul: ParentComponent = (props) => ( ); const Li: ParentComponent = (props) =>
  • {props.children}
  • ; export const Blockquote: ParentComponent = (props) => (
    {"> "}
    {props.children}
    ); const Pre: ParentComponent<{ lang: string; lines?: string; file?: string }> = ( props, ) => { const [copied, setCopied] = createSignal(false); let ref!: HTMLPreElement; const onCopy = () => { setCopied(true); navigator.clipboard.writeText(ref.innerText); setTimeout(() => { setCopied(false); }, 1500); }; return (
    }> {props.file}
    				{props.children}
    			
    ); }; const headingLink = (children: JSXElement) => children?.toString().toLowerCase().replaceAll(" ", "-").replaceAll(",", ""); const HeadlineLink: Component<{ link: string; class: string }> = (props) => { return ( link ); }; const H2: ParentComponent = (props) => (

    {props.children}

    ); const H3: ParentComponent = (props) => (

    {props.children}

    ); const H4: ParentComponent = (props) => (

    {props.children}

    ); const A: ParentComponent<{ href: string }> = (props) => { const isLocal = createMemo(() => ["/", "./", "#"].some((s) => props.href.startsWith(s)), ); return ( {props.children} ); }; function gridCellDimensions() { const element = document.createElement("div"); element.style.position = "fixed"; element.style.height = "var(--line-height)"; element.style.width = "1ch"; document.body.appendChild(element); const rect = element.getBoundingClientRect(); document.body.removeChild(element); return { width: rect.width, height: rect.height }; } export const PostImage: Component<{ src: string; alt: string; attr?: JSXElement; class?: string; }> = (props) => { let ref!: HTMLImageElement; onMount(() => { const cell = gridCellDimensions(); function setHeightFromRatio() { const ratio = ref.naturalWidth / ref.naturalHeight; const rect = ref.getBoundingClientRect(); const realHeight = rect.width / ratio; const diff = cell.height - (realHeight % cell.height); ref.style.setProperty("padding-bottom", `${diff}px`); } if (ref.complete) { setHeightFromRatio(); } else { ref.addEventListener("load", () => { setHeightFromRatio(); }); } }); return (
    {props.alt} {props.attr}
    ); }; export const Notes: ParentComponent = (props) => ( ); export const markdownComponents = { a: A, p: P, li: Li, ol: Ol, ul: Ul, blockquote: Blockquote, pre: Pre, h2: H2, h3: H3, h4: H4, };