mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-22 19:19:52 +02:00
18 lines
446 B
TypeScript
18 lines
446 B
TypeScript
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 variant="solid" children={node} />;
|
|
}
|