Skip to content

Commit 3f0abb5

Browse files
committed
working on MDX
1 parent 682f48f commit 3f0abb5

File tree

7 files changed

+1398
-36
lines changed

7 files changed

+1398
-36
lines changed

app/routes/MdxRoute.res

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,35 @@
11
open ReactRouter
22
open Mdx
33

4-
type loaderData = Mdx.t
4+
module Sidebar = SidebarLayout.Sidebar
5+
6+
module NavItem = Sidebar.NavItem
7+
module Category = Sidebar.Category
8+
9+
type loaderData = {...Mdx.t}
510

611
let loader: Loader.t<loaderData> = async ({request}) => {
7-
let res = await loadMdx(request)
12+
let mdx = await loadMdx(request)
13+
let res: loaderData = {__raw: mdx.__raw, attributes: mdx.attributes}
814
res
915
}
1016

1117
let default = () => {
1218
let component = useMdxComponent()
1319
let attributes = useMdxAttributes()
14-
<section>
15-
<h1> {React.string(attributes.title)} </h1>
16-
{component()}
17-
</section>
20+
let _ = Toc.useToc(~category="manual")
21+
22+
// TODO directly use layout and pass props
23+
24+
// Console.log(attributes)
25+
// <ManualDocsLayout.V1200Layout
26+
// metaTitleCategory="ReScript Language Manual"
27+
// version="latest"
28+
// availableVersions=Constants.allManualVersions
29+
// nextVersion=?Constants.nextVersion>
30+
// // {React.string(attributes.title)} </h1>
31+
<div className="markdown-body">
32+
<DocsLayout metaTitleCategory="Foo" categories=[]> {component()} </DocsLayout>
33+
</div>
34+
// </ManualDocsLayout.V1200Layout>
1835
}

docs/manual/introduction.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
---
22
title: "Introduction"
33
description: "Introduction to the ReScript programming language"
4-
canonical: "/docs/manual/v12.0.0/introduction"
4+
category: "manual"
5+
section: "overview"
6+
order: 1
57
---
68

79
# ReScript

0 commit comments

Comments
 (0)