-
I see from the docs that icons are supported by modifying the Source API: import { docs, meta } from "@/.source";
import { createMDXSource } from "fumadocs-mdx";
import { loader } from "fumadocs-core/source";
import { icons } from "lucide-react";
import { createElement } from "react";
export const source = loader({
baseUrl: "/docs",
source: createMDXSource(docs, meta),
icon(icon) {
console.log(`THE ICON PARAM IS ${icon}`);
if (!icon) {
// You may set a default icon
return;
}
if (icon in icons) return createElement(icons[icon as keyof typeof icons]);
},
}); Is it possible to automate rendering an external link icon for links to external sites, e.g in the markdown content |
Beta Was this translation helpful? Give feedback.
Answered by
fuma-nama
Feb 4, 2025
Replies: 1 comment 5 replies
-
You can do that by overriding the default return <MDX components={{ ...defaultMdxComponents, a: props => <YourComp /> }} /> |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
And you probably don't need to copy the source code at all, you can just add the icon in the children like
<Link {...props}><Icon />{props.children}</Link>