Module Memoir_content.Markdown_parser

Markdown parsing with YAML frontmatter support.

val extract_frontmatter : string -> string option * string

Split raw file content into (Some yaml, body) when it begins with a --- frontmatter block, or (None, content) otherwise.

val parse_yaml_frontmatter : string -> Content_types.frontmatter

Parse a YAML frontmatter string into a Content_types.frontmatter. Raises Failure on malformed YAML (the metadata is never silently dropped).

val frontmatter_of_content : string -> Content_types.frontmatter option

Parse the frontmatter from raw file content. None means the file has no frontmatter block at all. Raises Failure on malformed YAML.

val parse_markdown : string -> string

Render markdown body text to an HTML string.

val parse_markdown_file : path:string -> content:string -> Content_types.content_page

Parse a markdown file (frontmatter + body) into a content page with its HTML rendered.