1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-04-26 06:45:23 -04:00
jarv.is/mdx-components.ts

50 lines
1.3 KiB
TypeScript

import type { MDXComponents } from "mdx/types";
import Image from "./components/Image";
import Figure from "./components/Figure";
import Link from "./components/Link";
import Code from "./components/Code";
import Blockquote from "./components/Blockquote";
import HorizontalRule from "./components/HorizontalRule";
import * as Heading from "./components/Heading";
import * as List from "./components/List";
import Tweet from "./components/TweetEmbed";
import IFrame from "./components/IFrame";
import Video from "./components/Video";
import YouTube from "./components/YouTubeEmbed";
import Gist from "./components/GistEmbed";
import CodePen from "./components/CodePenEmbed";
import OctocatLink from "./components/OctocatLink";
export function useMDXComponents(components: MDXComponents): MDXComponents {
return {
...components,
// direct replacements for HTML tags generated by remark:
img: Image,
a: Link,
code: Code,
blockquote: Blockquote,
hr: HorizontalRule,
h1: Heading.H1,
h2: Heading.H2,
h3: Heading.H3,
h4: Heading.H4,
h5: Heading.H5,
h6: Heading.H6,
ul: List.UnorderedList,
ol: List.OrderedList,
li: List.ListItem,
// non-native components:
Figure,
IFrame,
Video,
YouTube,
Tweet,
Gist,
CodePen,
OctocatLink,
};
}