@@ -8,14 +8,49 @@ module Category = Sidebar.Category
88
99type loaderData = {... Mdx .t }
1010
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+
1146let loader : Loader .t <loaderData > = async ({request }) => {
1247 let mdx = await loadMdx (request )
1348 let res : loaderData = {__raw : mdx .__raw , attributes : mdx .attributes }
1449 res
1550}
1651
1752let default = () => {
18- let component = useMdxComponent ()
53+ let component = useMdxComponent (~ components )
1954 let attributes = useMdxAttributes ()
2055 let _ = Toc .useToc (~category = "manual" )
2156
@@ -28,8 +63,10 @@ let default = () => {
2863 // availableVersions=Constants.allManualVersions
2964 // nextVersion=?Constants.nextVersion>
3065 // // {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 >
3370 </div >
3471 // </ManualDocsLayout.V1200Layout>
3572}
0 commit comments