Skip to content

Commit dcb4518

Browse files
committed
use interface file
1 parent 4561432 commit dcb4518

File tree

2 files changed

+31
-25
lines changed

2 files changed

+31
-25
lines changed

src/common/MarkdownParser.res

+21-25
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,37 @@ type vfile<'a> = {..} as 'a
44

55
external makePlugin: 'a => plugin = "%identity"
66

7-
%%private(
8-
@module("unified") external make: unit => t = "unified"
7+
@module("unified") external make: unit => t = "unified"
98

10-
@module("remark-parse") external remarkParse: plugin = "default"
11-
@module("remark-gfm") external remarkGfm: plugin = "default"
12-
@module("remark-comment") external remarkComment: plugin = "default"
13-
@module("remark-frontmatter") external remarkFrontmatter: plugin = "default"
14-
@module("remark-stringify") external remarkStringify: plugin = "default"
9+
@module("remark-parse") external remarkParse: plugin = "default"
10+
@module("remark-gfm") external remarkGfm: plugin = "default"
11+
@module("remark-comment") external remarkComment: plugin = "default"
12+
@module("remark-frontmatter") external remarkFrontmatter: plugin = "default"
13+
@module("remark-stringify") external remarkStringify: plugin = "default"
1514

16-
@send external use: (t, plugin) => t = "use"
17-
@send external useOptions: (t, plugin, array<{..}>) => t = "use"
15+
@send external use: (t, plugin) => t = "use"
16+
@send external useOptions: (t, plugin, array<{..}>) => t = "use"
1817

19-
@send external processSync: (t, string) => vfile<'a> = "processSync"
20-
@send external toString: vfile<'a> => string = "toString"
18+
@send external processSync: (t, string) => vfile<'a> = "processSync"
19+
@send external toString: vfile<'a> => string = "toString"
2120

22-
@module("vfile-matter") external vfileMatter: vfile<'a> => unit = "matter"
23-
)
21+
@module("vfile-matter") external vfileMatter: vfile<'a> => unit = "matter"
2422

2523
type result = {
2624
frontmatter: JSON.t,
2725
content: string,
2826
}
2927

30-
%%private(
31-
let vfileMatterPlugin = makePlugin(_options => (_tree, vfile) => vfileMatter(vfile))
32-
33-
let parser =
34-
make()
35-
->use(remarkParse)
36-
->use(remarkStringify)
37-
->use(remarkGfm)
38-
->use(remarkComment)
39-
->useOptions(remarkFrontmatter, [{"type": "yaml", "marker": "-"}])
40-
->use(vfileMatterPlugin)
41-
)
28+
let vfileMatterPlugin = makePlugin(_options => (_tree, vfile) => vfileMatter(vfile))
29+
30+
let parser =
31+
make()
32+
->use(remarkParse)
33+
->use(remarkStringify)
34+
->use(remarkGfm)
35+
->use(remarkComment)
36+
->useOptions(remarkFrontmatter, [{"type": "yaml", "marker": "-"}])
37+
->use(vfileMatterPlugin)
4238

4339
let parseSync = content => {
4440
let vfile = parser->processSync(content)

src/common/MarkdownParser.resi

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
type t
2+
type plugin
3+
type vfile<'a> = {..} as 'a
4+
5+
type result = {
6+
frontmatter: JSON.t,
7+
content: string,
8+
}
9+
10+
let parseSync: string => result

0 commit comments

Comments
 (0)