mirror of
https://github.com/massbug/judge4c.git
synced 2025-05-18 15:26:33 +00:00
feat(mdx-preview): integrate CodeBlockWithCopy for enhanced code block functionality
This commit is contained in:
parent
ff682d8ca2
commit
89ea5b4684
@ -4,14 +4,15 @@ import "@/style/mdx.css";
|
|||||||
import "katex/dist/katex.min.css";
|
import "katex/dist/katex.min.css";
|
||||||
import remarkGfm from "remark-gfm";
|
import remarkGfm from "remark-gfm";
|
||||||
import remarkMath from "remark-math";
|
import remarkMath from "remark-math";
|
||||||
// import rehypeSlug from "rehype-slug";
|
|
||||||
import rehypeKatex from "rehype-katex";
|
import rehypeKatex from "rehype-katex";
|
||||||
import { useTheme } from "next-themes";
|
import { useTheme } from "next-themes";
|
||||||
|
// import rehypeSlug from "rehype-slug";
|
||||||
import rehypePretty from "rehype-pretty-code";
|
import rehypePretty from "rehype-pretty-code";
|
||||||
import { Skeleton } from "@/components/ui/skeleton";
|
import { Skeleton } from "@/components/ui/skeleton";
|
||||||
import { serialize } from "next-mdx-remote/serialize";
|
import { serialize } from "next-mdx-remote/serialize";
|
||||||
import { useCallback, useEffect, useState } from "react";
|
import { useCallback, useEffect, useState } from "react";
|
||||||
import { CircleAlert, TriangleAlert } from "lucide-react";
|
import { CircleAlert, TriangleAlert } from "lucide-react";
|
||||||
|
import { CodeBlockWithCopy } from "./mdx/code-block-with-copy";
|
||||||
// import rehypeAutolinkHeadings from "rehype-autolink-headings";
|
// import rehypeAutolinkHeadings from "rehype-autolink-headings";
|
||||||
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
|
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
|
||||||
import { MDXRemote, MDXRemoteSerializeResult } from "next-mdx-remote";
|
import { MDXRemote, MDXRemoteSerializeResult } from "next-mdx-remote";
|
||||||
@ -30,6 +31,7 @@ export default function MdxPreview({ source }: MdxPreviewProps) {
|
|||||||
// Define your custom components here
|
// Define your custom components here
|
||||||
// For example:
|
// For example:
|
||||||
// Test: ({ name }: { name: string }) => <p>Test Component: {name}</p>,
|
// Test: ({ name }: { name: string }) => <p>Test Component: {name}</p>,
|
||||||
|
pre: CodeBlockWithCopy,
|
||||||
};
|
};
|
||||||
|
|
||||||
const getMdxSource = useCallback(async () => {
|
const getMdxSource = useCallback(async () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user