import type { Components } from "react-markdown";
import { Code, isSupportedLanguage } from "./components/Code";
import { InlineLink } from "./components/InlineLink";
import { Styled } from "./components/Styled";
export const MARKDOWN_COMPONENTS = {
h1: Styled("h1", "mb-8 text-4xl font-medium"),
a: InlineLink,
pre: (props) => {
const firstChild = props.node?.children[0];
if (
props.node?.children.length === 1 &&
firstChild &&
"tagName" in firstChild &&
firstChild.tagName === "code"
) {
const { className } = firstChild.properties;
const className_ = Array.isArray(className) ? className[0] : className;
const language = /language-(\w+)/.exec(
typeof className_ === "string" ? className_ : "",
)?.[1];
const codeNode = firstChild.children[0];
return (
{codeNode !== undefined && "value" in codeNode ? codeNode.value : ""}
);
} else {
return