-
Code reproduction: Stackblitz I am trying to configure codehike with Fumadocs version 13. On the page of export async function Code({ codeblock }: { codeblock: RawCode }) {
const highlighted = await highlight(codeblock, "github-from-css");
return (
<Pre
code={highlighted}
handlers={[borderHandler, bgHandler]}
className="border bg-card"
/>
);
}
const borderHandler: AnnotationHandler = {
name: "border",
Block: ({ annotation, children }) => {
const borderColor = annotation.query || "red";
return <div style={{ border: "1px solid", borderColor }}>{children}</div>;
},
}; However, effect does not work as below image. Any idea? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
look that fumadocs changed how to set up mdx in the latest release you now have to
// source.config.ts
import { defineDocs, defineConfig } from "fumadocs-mdx/config";
import { remarkCodeHike, recmaCodeHike } from "codehike/mdx";
export const { docs, meta } = defineDocs();
/** @type {import('codehike/mdx').CodeHikeConfig} */
const chConfig = {
components: { code: "Code" },
};
export default defineConfig({
mdxOptions: {
remarkPlugins: [[remarkCodeHike, chConfig]],
recmaPlugins: [[recmaCodeHike, chConfig]],
jsx: true,
},
}); // app/docs/[[slug]]/page.tsx
import { Code } from "@/components/code";
...
<MDX components={{ ...defaultMdxComponents, Code }} /> |
Beta Was this translation helpful? Give feedback.
-
@pomber Error that I got:
Custom
|
Beta Was this translation helpful? Give feedback.
-
the error means that the <Scrollycoding>
### !!steps hi
foo
### !!steps xx
xx
</Scrollycoding>
|
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
look that fumadocs changed how to set up mdx in the latest release
you now have to
source.config.ts
(instead ofnext.config.mjs
)app/docs/[[slug]]/page.tsx
), not sure whymdx-components.tsx
is ignored