generated from leerob/next-mdx-blog
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathmdx-components.tsx
More file actions
36 lines (34 loc) · 1.01 KB
/
mdx-components.tsx
File metadata and controls
36 lines (34 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import Link from 'next/link';
import { H1, H2, H3, H4, H5, H6 } from '@/components/mdx/Heading';
import { Paragraph, Strong, Em, Blockquote } from '@/components/mdx/Text';
import { UnorderedList, OrderedList, ListItem } from '@/components/mdx/List';
import { InlineCode, Pre } from '@/components/mdx/Code';
import { ExternalLink } from '@/components/mdx/ExternalLink';
import { DocumentViewer, PDF, PPT } from '@/components/mdx/DocumentViewer';
// Allow both sync and async server components
type MDXComponent = React.ComponentType<any> | ((props: any) => Promise<React.JSX.Element>);
type MDXComponents = Record<string, MDXComponent>;
export function useMDXComponents(): MDXComponents {
return {
h1: H1,
h2: H2,
h3: H3,
h4: H4,
h5: H5,
h6: H6,
p: Paragraph,
strong: Strong,
em: Em,
blockquote: Blockquote,
ul: UnorderedList,
ol: OrderedList,
li: ListItem,
code: InlineCode,
pre: Pre,
a: ExternalLink,
// Document viewers
DocumentViewer,
PDF,
PPT,
};
}