{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "mdx",
  "title": "MDX components",
  "description": "defaultMdxComponents for Fumadocs MDX content (code blocks, headings, links, images, tables, cards and callouts) and createRelativeLink.",
  "dependencies": [
    "cn",
    "fumadocs-core@^16.17.8"
  ],
  "devDependencies": [
    "@types/mdx"
  ],
  "registryDependencies": [
    "@docscn/heading",
    "@docscn/codeblock",
    "@docscn/card",
    "@docscn/callout"
  ],
  "files": [
    {
      "path": "registry/base/docs/mdx.tsx",
      "content": "// Adapted from Fumadocs UI (https://github.com/fuma-nama/fumadocs)\n// Copyright (c) 2023 Fuma, MIT License\nimport { cn } from \"cn\";\nimport { Image as FrameworkImage } from \"fumadocs-core/framework\";\nimport Link from \"fumadocs-core/link\";\nimport type { LoaderConfig, LoaderOutput, Page } from \"fumadocs-core/source\";\nimport type * as React from \"react\";\nimport type {\n  AnchorHTMLAttributes,\n  ComponentProps,\n  FC,\n  HTMLAttributes,\n  ImgHTMLAttributes,\n  TableHTMLAttributes,\n} from \"react\";\nimport { Card, Cards } from \"./components/card\";\nimport {\n  Callout,\n  CalloutContainer,\n  CalloutDescription,\n  CalloutTitle,\n} from \"./components/callout\";\nimport {\n  CodeBlock,\n  CodeBlockTab,\n  CodeBlockTabs,\n  CodeBlockTabsList,\n  CodeBlockTabsTrigger,\n  Pre,\n} from \"./components/codeblock\";\nimport { Heading } from \"./components/heading\";\n\n/**\n * global types for MDX.js\n */\ndeclare module \"mdx/types.js\" {\n  // Augment the MDX types to make it understand React.\n  // eslint-disable-next-line @typescript-eslint/no-namespace\n  namespace JSX {\n    type Element = React.JSX.Element;\n    type ElementClass = React.JSX.ElementClass;\n    type ElementType = React.JSX.ElementType;\n    type IntrinsicElements = React.JSX.IntrinsicElements;\n  }\n}\n\nfunction Image(props: ImgHTMLAttributes<HTMLImageElement>) {\n  return (\n    <FrameworkImage\n      sizes=\"(max-width: 768px) 100vw, (max-width: 1200px) 70vw, 900px\"\n      {...(props as ComponentProps<typeof FrameworkImage>)}\n      className={cn(\"rounded-lg\", props.className)}\n    />\n  );\n}\n\nfunction Table(props: TableHTMLAttributes<HTMLTableElement>) {\n  return (\n    <div className=\"relative my-6 overflow-auto *:my-0\" tabIndex={0}>\n      <table {...props} />\n    </div>\n  );\n}\n\nconst defaultMdxComponents = {\n  CodeBlockTab,\n  CodeBlockTabs,\n  CodeBlockTabsList,\n  CodeBlockTabsTrigger,\n  pre: (props: HTMLAttributes<HTMLPreElement>) => (\n    <CodeBlock {...props}>\n      <Pre>{props.children}</Pre>\n    </CodeBlock>\n  ),\n  Card,\n  Cards,\n  a: Link as FC<AnchorHTMLAttributes<HTMLAnchorElement>>,\n  img: Image,\n  h1: (props: HTMLAttributes<HTMLHeadingElement>) => (\n    <Heading as=\"h1\" {...props} />\n  ),\n  h2: (props: HTMLAttributes<HTMLHeadingElement>) => (\n    <Heading as=\"h2\" {...props} />\n  ),\n  h3: (props: HTMLAttributes<HTMLHeadingElement>) => (\n    <Heading as=\"h3\" {...props} />\n  ),\n  h4: (props: HTMLAttributes<HTMLHeadingElement>) => (\n    <Heading as=\"h4\" {...props} />\n  ),\n  h5: (props: HTMLAttributes<HTMLHeadingElement>) => (\n    <Heading as=\"h5\" {...props} />\n  ),\n  h6: (props: HTMLAttributes<HTMLHeadingElement>) => (\n    <Heading as=\"h6\" {...props} />\n  ),\n  table: Table,\n  Callout,\n  CalloutContainer,\n  CalloutTitle,\n  CalloutDescription,\n};\n\n/**\n * Extend the default Link component to resolve relative file paths in `href`.\n *\n * Only works in server components.\n *\n * @param page the current page\n * @param source the source object\n * @param OverrideLink The component to override from\n */\nexport function createRelativeLink<C extends LoaderConfig>(\n  source: LoaderOutput<C>,\n  page: Page | C[\"page\"],\n  OverrideLink: FC<ComponentProps<\"a\">> = defaultMdxComponents.a,\n): FC<ComponentProps<\"a\">> {\n  return async function RelativeLink({ href, ...props }) {\n    return (\n      <OverrideLink\n        href={href ? source.resolveHref(href, page) : href}\n        {...props}\n      />\n    );\n  };\n}\n\nexport { defaultMdxComponents, defaultMdxComponents as default };\n",
      "type": "registry:component",
      "target": "@components/docs/mdx.tsx"
    }
  ],
  "type": "registry:component"
}