Frontmatter and section mechanics shared by every authored artifact — intent cards and design docs.
Frontmatter is a hand-parsed key/value block, deliberately not YAML: the keys cohere manages are flat strings, and a YAML parser would be a dependency consumers inherit for no expressive gain.
Summary
Functions
Appends a line to the named ## section, creating the section at the end if absent.
Backticked, fully-qualified code references in markdown text:
[{module_string, function_name | nil, arity | nil}], deduped in order.
HTML comments are stripped first — a ref in a skeleton prompt is an
example, not a claim.
Whether a code_refs/1 tuple resolves in the compiled app: the module
loads, and the function (when given) is exported at that arity.
Rewrites the frontmatter block, emitting keys in order with values from
front. Keys whose value is nil or empty are dropped.
Parses ##-delimited sections into a %{"Heading" => content} map.
Splits a document into {:ok, frontmatter_map, body}, where the
frontmatter is the leading --- block parsed as key: value lines.
Functions
Appends a line to the named ## section, creating the section at the end if absent.
Backticked, fully-qualified code references in markdown text:
[{module_string, function_name | nil, arity | nil}], deduped in order.
HTML comments are stripped first — a ref in a skeleton prompt is an
example, not a claim.
Whether a code_refs/1 tuple resolves in the compiled app: the module
loads, and the function (when given) is exported at that arity.
Rewrites the frontmatter block, emitting keys in order with values from
front. Keys whose value is nil or empty are dropped.
Parses ##-delimited sections into a %{"Heading" => content} map.
@spec split_frontmatter(String.t()) :: {:ok, %{required(String.t()) => String.t()}, String.t()} | {:error, :no_frontmatter}
Splits a document into {:ok, frontmatter_map, body}, where the
frontmatter is the leading --- block parsed as key: value lines.