add userpage

This commit is contained in:
Kaustubh Maske Patil 2025-06-01 01:05:21 +05:30
parent a6fd0fcc2c
commit 1780e5c6a6
3 changed files with 16 additions and 1 deletions

View File

@ -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
View 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

View File

@ -22,4 +22,4 @@
"@opam/ocaml-lsp-server": "1.21.0",
"@opam/ocamlformat": "0.27.0"
}
}
}