@@ -22,7 +22,7 @@ module Params = {
22
22
type t = {slug : string }
23
23
}
24
24
25
- type props = {mdxSource : Mdx . Remote .output , isArchived : bool , path : string }
25
+ type props = {mdxSource : MdxRemote .output , isArchived : bool , path : string }
26
26
27
27
module Line = {
28
28
@react.component
@@ -116,29 +116,16 @@ module BlogHeader = {
116
116
}
117
117
}
118
118
119
- type remarkPlugin
120
- @module ("remark-comment" ) external remarkComment : remarkPlugin = "default"
121
- @module ("remark-gfm" ) external remarkGfm : remarkPlugin = "default"
122
- @module ("remark-frontmatter" ) external remarkFrontmatter : remarkPlugin = "default"
123
-
124
- let mdxOptions = {"remarkPlugins" : [remarkComment , remarkGfm , remarkFrontmatter ]}
125
-
126
- external asProps : {.. } => {"props" : Mdx .Remote .output } = "%identity"
127
-
128
119
let default = (props : props ) => {
129
120
let {mdxSource , isArchived , path } = props
130
121
131
- let mdxProps = {
132
- "frontmatter" : mdxSource .frontmatter ,
133
- "scope" : mdxSource .scope ,
134
- "compiledSource" : mdxSource .compiledSource ,
135
- "components" : Markdown .default ,
136
- "options" : {
137
- "mdxOptions" : mdxOptions ,
138
- },
139
- }
140
-
141
- let children = React .createElement (Mdx .MDXRemote .make , asProps (mdxProps ))
122
+ let children =
123
+ <MdxRemote
124
+ frontmatter = {mdxSource .frontmatter }
125
+ compiledSource = {mdxSource .compiledSource }
126
+ scope = {mdxSource .scope }
127
+ components = {MarkdownComponents .default }
128
+ />
142
129
143
130
let fm = mdxSource .frontmatter -> BlogFrontmatter .decode
144
131
@@ -230,11 +217,11 @@ let getStaticProps: Next.GetStaticProps.t<props, Params.t> = async ctx => {
230
217
231
218
let isArchived = Js .String2 .startsWith (path , "archive/" )
232
219
233
- let source = filePath -> Node .Fs .readFileSync ( #utf8 )
220
+ let source = filePath -> Node .Fs .readFileSync
234
221
235
- let mdxSource = await Mdx . Remote .serialize (
222
+ let mdxSource = await MdxRemote .serialize (
236
223
source ,
237
- {" parseFrontmatter" : true , " mdxOptions" : mdxOptions },
224
+ {parseFrontmatter : true , mdxOptions : MdxRemote . defaultMdxOptions },
238
225
)
239
226
240
227
let props = {mdxSource , isArchived , path }
0 commit comments