feat: types

This commit is contained in:
TrèsAbhi committed 2026-03-19 18:17:36 -05:00
1 parent cef18d4f64
commit c99ed0cb53
11 files changed
+195 -2

No files matched your search

@@ -0,0 +1,28 @@
import type { Root } from "hast";
import { toJsxRuntime } from "hast-util-to-jsx-runtime";
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
import { Code } from "./Code";
interface Props {
tree: Root | string;
}
export function HighlightedCodeContent({ tree }: Props) {
const node =
typeof tree === "string"
? tree
: toJsxRuntime(tree, { Fragment, jsx, jsxs });
return (
<Code
style={{
overflow: "auto",
padding: "var(--space-3)",
display: "block",
whiteSpace: "pre",
lineHeight: "1.5em",
}}
children={node}
/>
);
}