@@ -8,14 +8,49 @@ module Category = Sidebar.Category
8
8
9
9
type loaderData = {... Mdx .t }
10
10
11
+ /**
12
+ This configures the MDX component to use our custom markdown components
13
+ */
14
+ let components = {
15
+ // Replacing HTML defaults
16
+ "a" : Markdown .A .make ,
17
+ "blockquote" : Markdown .Blockquote .make ,
18
+ "code" : Markdown .Code .make ,
19
+ "h1" : Markdown .H1 .make ,
20
+ "h2" : Markdown .H2 .make ,
21
+ "h3" : Markdown .H3 .make ,
22
+ "h4" : Markdown .H4 .make ,
23
+ "h5" : Markdown .H5 .make ,
24
+ "hr" : Markdown .Hr .make ,
25
+ "intro" : Markdown .Intro .make ,
26
+ "li" : Markdown .Li .make ,
27
+ "ol" : Markdown .Ol .make ,
28
+ "p" : Markdown .P .make ,
29
+ "pre" : Markdown .Pre .make ,
30
+ "strong" : Markdown .Strong .make ,
31
+ "table" : Markdown .Table .make ,
32
+ "th" : Markdown .Th .make ,
33
+ "thead" : Markdown .Thead .make ,
34
+ "ul" : Markdown .Ul .make ,
35
+ // These are custom components we provide
36
+ "Cite" : Markdown .Cite .make ,
37
+ "CodeTab" : Markdown .CodeTab .make ,
38
+ "Image" : Markdown .Image .make ,
39
+ "Info" : Markdown .Info .make ,
40
+ "Intro" : Markdown .Intro .make ,
41
+ "UrlBox" : Markdown .UrlBox .make ,
42
+ "Video" : Markdown .Video .make ,
43
+ "Warn" : Markdown .Warn .make ,
44
+ }
45
+
11
46
let loader : Loader .t <loaderData > = async ({request }) => {
12
47
let mdx = await loadMdx (request )
13
48
let res : loaderData = {__raw : mdx .__raw , attributes : mdx .attributes }
14
49
res
15
50
}
16
51
17
52
let default = () => {
18
- let component = useMdxComponent ()
53
+ let component = useMdxComponent (~ components )
19
54
let attributes = useMdxAttributes ()
20
55
let _ = Toc .useToc (~category = "manual" )
21
56
@@ -28,8 +63,10 @@ let default = () => {
28
63
// availableVersions=Constants.allManualVersions
29
64
// nextVersion=?Constants.nextVersion>
30
65
// // {React.string(attributes.title)} </h1>
31
- <div className = "markdown-body" >
32
- <DocsLayout metaTitleCategory = "Foo" categories = []> {component ()} </DocsLayout >
66
+ <div >
67
+ <DocsLayout metaTitleCategory = "Foo" categories = []>
68
+ <div className = "markdown-body" > {component ()} </div >
69
+ </DocsLayout >
33
70
</div >
34
71
// </ManualDocsLayout.V1200Layout>
35
72
}
0 commit comments