(undefined);
function DefaultPre(props: ComponentProps<"pre">) {
const extraProps = use(PropsContext);
return (
{props.children}
);
}
export function DynamicCodeBlock({
lang,
code,
codeblock,
options,
wrapInSuspense = true,
allowCopy = true,
}: DynamicCodeblockProps) {
const shikiOptions = {
lang,
...options,
components: {
pre: DefaultPre,
...options?.components,
},
} satisfies HighlightOptions;
let children = ;
if (wrapInSuspense)
children = (
}
>
{children}
);
return (
{children}
);
}
function Placeholder({
code,
components = {},
}: {
code: string;
components: HighlightOptions["components"];
}) {
const { pre: Pre = "pre", code: Code = "code" } = components as Record<
string,
FC
>;
return (
{code.split("\n").map((line, i) => (
{line}
))}
);
}
function Internal({
code,
options,
}: {
code: string;
options: HighlightOptions;
}) {
return useShiki(code, options);
}