add userpage
This commit is contained in:
parent
a6fd0fcc2c
commit
1780e5c6a6
@ -1,3 +1,12 @@
|
||||
let ( let* ) = Result.bind
|
||||
|
||||
module UserPage = struct
|
||||
type t = { frontmatter : Frontmatter.t; content : string }
|
||||
|
||||
let of_string md =
|
||||
let yaml, content = Frontmatter.extract_frontmatter md in
|
||||
let* frontmatter = Frontmatter.parse_frontmatter yaml in
|
||||
Ok { frontmatter; content }
|
||||
|
||||
let of_file filepath = Eio.Path.load filepath |> of_string
|
||||
end
|
||||
|
||||
6
lib/page.mli
Normal file
6
lib/page.mli
Normal file
@ -0,0 +1,6 @@
|
||||
module UserPage : sig
|
||||
type t = { frontmatter : Frontmatter.t; content : string }
|
||||
|
||||
val of_string : string -> (t, string) Result.t
|
||||
val of_file : 'a Eio.Path.t -> (t, string) Result.t
|
||||
end
|
||||
@ -22,4 +22,4 @@
|
||||
"@opam/ocaml-lsp-server": "1.21.0",
|
||||
"@opam/ocamlformat": "0.27.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user