-
Notifications
You must be signed in to change notification settings - Fork 45
/
MDXProvider.jsx
37 lines (35 loc) · 973 Bytes
/
MDXProvider.jsx
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
37
import React from "react";
import { MDXProvider } from "@mdx-js/react";
import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
import okaidia from "react-syntax-highlighter/dist/cjs/styles/prism/okaidia";
import SlidePage from "../layouts/SlidePage";
import Cover from "./Cover";
import SpeakerNotes from "./SpeakerNotes";
import Step from "./Step";
import Steps from "./Steps";
import { motion } from "framer-motion";
const mdComponents = {
h1: (props) => <h1 {...props} />,
pre: (props) => props.children,
code: (props) => {
const { className } = props;
const language = className.replace("language-", "");
return (
<SyntaxHighlighter
className={className}
language={language}
style={okaidia}
{...props}
/>
);
},
Cover,
SlidePage,
SpeakerNotes,
Step,
Steps,
motion,
};
export default ({ children }) => (
<MDXProvider components={mdComponents}>{children}</MDXProvider>
);