-
Enabling toc on fumadocs causes all htags from codehike components to be included. Is there a way to exclude them? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
I think it shouldn't be a problem if you run |
Beta Was this translation helpful? Give feedback.
-
I used the example template for fumadocs you've provided here, so the config is unchanged from: import { remarkCodeHike, recmaCodeHike } from "codehike/mdx"
import createMDX from "fumadocs-mdx/config"
/** @type {import('codehike/mdx').CodeHikeConfig} */
const chConfig = {
components: {
code: "Code",
},
}
const withMDX = createMDX({
mdxOptions: {
remarkPlugins: [[remarkCodeHike, chConfig]],
recmaPlugins: [[recmaCodeHike, chConfig]],
jsx: true,
},
})
/** @type {import('next').NextConfig} */
const config = {
reactStrictMode: true,
}
export default withMDX(config) The only update was in import { getPage, getPages } from "@/app/source";
import type { Metadata } from "next";
import { DocsPage, DocsBody } from "fumadocs-ui/page";
import { notFound } from "next/navigation";
export default async function Page({
params,
}: {
params: { slug?: string[] };
}) {
const page = getPage(params.slug);
if (page == null) {
notFound();
}
const MDX = page.data.exports.default;
return (
<DocsPage
full={page.data.full}
tableOfContent={{ enabled: true }}
toc={page.data.exports.toc}
>
<DocsBody>
<h1>{page.data.title}</h1>
<MDX />
</DocsBody>
</DocsPage>
);
}
export async function generateStaticParams() {
return getPages().map((page) => ({
slug: page.slugs,
}));
}
export function generateMetadata({ params }: { params: { slug?: string[] } }) {
const page = getPage(params.slug);
if (page == null) notFound();
return {
title: page.data.title,
description: page.data.description,
} satisfies Metadata;
} I did initally try to update the 3 fumadocs dependencies to the latest versions, but had trouble figuring out how to update the template to work with fumadocs-mdx v10.0. |
Beta Was this translation helpful? Give feedback.
-
Oh btw, I also dmed you via twitter about docskit.codehike.org |
Beta Was this translation helpful? Give feedback.
not sure what version of fumadocs added this, but try:
that should make codehike plugin run before fumadocs'