import NextImage from "next/image"; import Link from "@/components/link"; import CodeBlock from "@/components/code-block"; import HeadingAnchor from "@/components/heading-anchor"; import Video from "@/components/video"; import ImageDiff from "./components/image-diff"; import Tweet from "@/components/third-party/tweet"; import YouTube from "@/components/third-party/youtube"; import Gist from "@/components/third-party/gist"; import CodePen from "@/components/third-party/codepen"; import { cn } from "@/lib/utils"; import type { MDXComponents } from "mdx/types"; export const useMDXComponents = (components: MDXComponents): MDXComponents => { return { ...components, a: Link, pre: ({ className, ...rest }) => , code: ({ className, ...rest }) => ( // only applies to inline code, *not* highlighted code blocks! ), img: ({ src, className, ...rest }) => ( 896 ? 896 : undefined} // => var(--container-4xl) className={cn( "mx-auto my-8 block h-auto max-w-full rounded-md", "[&+em]:text-muted-foreground [&+em]:-mt-4 [&+em]:block [&+em]:text-center [&+em]:text-[0.875em] [&+em]:leading-normal [&+em]:font-medium [&+em]:not-italic", className )} {...rest} /> ), figure: ({ className, ...rest }) =>
, figcaption: ({ className, ...rest }) => (
), blockquote: ({ className, ...rest }) => (
), h1: ({ className, id, children, ...rest }) => (

{children} {id && }

), h2: ({ className, id, children, ...rest }) => (

{children} {id && }

), h3: ({ className, id, children, ...rest }) => (

{children} {id && }

), h4: ({ className, ...rest }) => (

), h5: ({ className, ...rest }) => (

), h6: ({ className, ...rest }) => (
), ul: ({ className, ...rest }) =>
    li]:pl-1.5", className)} {...rest} />, ol: ({ className, ...rest }) =>
      li]:pl-1.5", className)} {...rest} />, li: ({ className, ...rest }) => (
    1. ol]:my-1 [&>ul]:my-1", className )} {...rest} /> ), hr: ({ className, ...rest }) => (
      ), // react components and embeds: Video, ImageDiff, Tweet, YouTube, Gist, CodePen, }; };