forked from npm/documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwrap-root-element.js
More file actions
45 lines (42 loc) · 1.05 KB
/
wrap-root-element.js
File metadata and controls
45 lines (42 loc) · 1.05 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
37
38
39
40
41
42
43
44
45
import { MDXProvider } from '@mdx-js/react'
import { Link, theme } from '@primer/components'
import React from 'react'
import { ThemeProvider } from 'styled-components'
import Blockquote from './blockquote'
import Code from './code'
import DescriptionList from './description-list'
import { H1, H2, H3, H4, H5, H6 } from './heading'
import HorizontalRule from './horizontal-rule'
import Image from './image'
import InlineCode from './inline-code'
import List from './list'
import Paragraph from './paragraph'
import Table from './table'
const components = {
a: Link,
pre: props => props.children,
code: Code,
inlineCode: InlineCode,
table: Table,
img: Image,
p: Paragraph,
hr: HorizontalRule,
blockquote: Blockquote,
h1: H1,
h2: H2,
h3: H3,
h4: H4,
h5: H5,
h6: H6,
ul: List,
ol: List.withComponent('ol'),
dl: DescriptionList,
}
function wrapRootElement ({ element }) {
return (
<MDXProvider components={components}>
<ThemeProvider theme={theme}>{element}</ThemeProvider>
</MDXProvider>
)
}
export default wrapRootElement