mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 11:39:50 +02:00
feat: types
This commit is contained in:
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}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user