ExternalConfigs.Frontmatter (fnord v0.9.31)

View Source

Parses YAML frontmatter out of markdown-like documents.

Supported input:

---
key: value
other: [a, b]
---
Body markdown goes here.

Returns {:ok, %{frontmatter: map(), body: binary()}} on success. Inputs that do not contain a complete --- ... --- block (no opener, or an opener without a closer) are returned as body with an empty frontmatter map. The original content is preserved verbatim so callers can still display or re-parse it.

Summary

Types

parsed()

@type parsed() :: %{frontmatter: map(), body: binary()}

Functions

parse(content)

@spec parse(binary()) :: {:ok, parsed()} | {:error, term()}