diff --git a/app/docs/[[...slug]]/page.tsx b/app/docs/[[...slug]]/page.tsx index c529d34a..67cae38c 100644 --- a/app/docs/[[...slug]]/page.tsx +++ b/app/docs/[[...slug]]/page.tsx @@ -250,9 +250,7 @@ export default async function Page(props: {
+
+ pnpm
+
+ {" dlx shadcn@latest add @8bitcn/button"}
+
+
+
+ );
+ const renderedText = new DOMParser().parseFromString(markup, "text/html")
+ .body.textContent;
+
+ expect(renderedText).toContain(installCommand);
+ expect(markup).toContain('class="line"');
+ expect(markup).toContain("--shiki-light:#6f42c1");
+ expect(markup).not.toContain("client-code-snippet");
+ });
+
+ it("keeps inline code styling", () => {
+ const Code = mdxComponents.code;
+ const markup = renderToStaticMarkup(components.json);
+
+ expect(markup).toContain("components.json");
+ expect(markup).toContain("bg-muted");
+ });
+});
diff --git a/mdx-components.tsx b/mdx-components.tsx
index 797eb591..dc7f27b1 100644
--- a/mdx-components.tsx
+++ b/mdx-components.tsx
@@ -1,13 +1,9 @@
import { icons } from "@tabler/icons-react";
+import { CodeBlock, Pre } from "fumadocs-ui/components/codeblock";
import Image from "next/image";
import Link from "next/link";
-import {
- type ComponentProps,
- type HTMLAttributes,
- isValidElement,
- type ReactNode,
-} from "react";
+import type { ComponentProps, HTMLAttributes } from "react";
import { Kbd } from "@/components/ui/8bit/kbd";
import {
Accordion,
@@ -21,8 +17,6 @@ import { Button } from "@/components/ui/button";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
import { cn } from "@/lib/utils";
-import CodeSnippet from "./components/code-snippet";
-
export const mdxComponents = {
h1: ({ className, ...props }: ComponentProps<"h1">) => (
),
pre: ({ className, children, ...props }: ComponentProps<"pre">) => (
-
- {children}
-
+ {children}
+
),
figure: ({ className, ...props }: ComponentProps<"figure">) => (
+ {children}
+
+ );
},
Step: ({ className, ...props }: ComponentProps<"h3">) => (