-
I tryed to write a simple compoent like this: export type CodeBlockProps = {
code: string;
lang?: string;
};
const CodeBlock = ({ code, lang = "typescript" }: CodeBlockProps) => {
const highlightCode = useRequest(
() =>
highlight(
{
value: code,
lang,
meta: "",
},
"github-light"
),
{
refreshDeps: [code, lang],
}
);
return (
<Spin spinning={highlightCode.loading}>
{highlightCode.data && <Pre code={highlightCode.data} />}
</Spin>
);
}; It seems to be ok when renderring, howerer token transitions disappears when switch code. I don't know whether it's a problem about my usage or some otherthing will be setted when using in mdx. |
Beta Was this translation helpful? Give feedback.
Answered by
pomber
Mar 3, 2025
Replies: 1 comment 1 reply
-
yes, it should work without mdx not sure about the token transitions, you are not passing any |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
asurance
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
yes, it should work without mdx
not sure about the token transitions, you are not passing any
handler
to thePre
component in your example