MCPcopy
hub / github.com/danielpetho/fancy / mdxComponents

Function mdxComponents

src/mdx-components.tsx:26–291  ·  view source on GitHub ↗
(components?: MDXComponents)

Source from the content-addressed store, hash-verified

24import { BlockMath, InlineMath } from "react-katex"
25
26export function mdxComponents(components?: MDXComponents): MDXComponents {
27 return {
28 h1: ({ className, children, ...props }: React.ComponentProps<"h1">) => (
29 <h1
30 id={children?.toString().toLowerCase().replace(/\s+/g, "-")}
31 className={cn(
32 "text-[44px] font-calendas tracking-tighter text-pretty leading-tight",
33 className
34 )}
35 {...props}
36 >
37 {children}
38 </h1>
39 ),
40 h2: ({ className, children, ...props }: React.ComponentProps<"h2">) => (
41 <>
42 <h2
43 id={children?.toString().toLowerCase().replace(/\s+/g, "-")}
44 className={cn("text-3xl md:text-4xl font-medium mb-0 py-0 mt-14 tracking-tight", className)}
45 {...props}
46 >
47 {children}
48 </h2>
49 <hr className="mt-2.5" />
50 </>
51 ),
52 h3: ({ className, children, ...props }: React.ComponentProps<"h3">) => (
53 <h3
54 id={children?.toString().toLowerCase().replace(/\s+/g, "-")}
55 className={cn("text-xl md:text-2xl font-medium py-0 mt-12 [h2+hr+&]:mt-0 tracking-tight", className)}
56 {...props}
57 >
58 {children}
59 </h3>
60 ),
61 h4: ({ className, children, ...props }: React.ComponentProps<"h4">) => (
62 <h4
63 id={children?.toString().toLowerCase().replace(/\s+/g, "-")}
64 className={cn("text-lg md:text-xl font-medium py-0 mt-10 [h3+&]:mt-0 tracking-tight", className)}
65 {...props}
66 >
67 {children}
68 </h4>
69 ),
70 a: ({
71 className,
72 children,
73 ...props
74 }: React.HTMLAttributes<HTMLAnchorElement>) => (
75 <a
76 className={cn(
77 "font-medium text-base md:text-lg text-blue hover:text-blue-400 dark:text-blue-400 dark:hover:text-blue-300 duration-300 ease-out transition-[color,background-color,opacity] inline-flex items-center leading-0 rounded-sm focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-blue",
78 className
79 )}
80 {...props}
81 >
82 {children}
83 <ExternalLinkIcon className="ml-1 mt-0.5" size={14} strokeWidth={2.5} />

Callers 1

getDocFromParamsFunction · 0.90

Calls 2

cnFunction · 0.90
toStringMethod · 0.80

Tested by

no test coverage detected