Expand description
Frontmatter mode: address the leading TOML (+++) or YAML (---) metadata
block of a Markdown-ish file as a config document, leaving the body bytes
untouched.
This backend does not parse Markdown. It splits the source into three
byte-exact spans — the opening delimiter line, the frontmatter block, and
the closing delimiter line plus everything after it (the body) — and hands
only the middle span to the inner TOML/YAML backend. Every edit re-splices
pre + edited_frontmatter + post, so the body survives verbatim; the frozen
body is exactly why frontmatter mode is source-preserving-only (there is no
whole-document re-render — the body is not part of the parsed value).
Detection is never automatic: the caller selects the delimiter explicitly
(--input-format toml-frontmatter|yaml-frontmatter). A file that does not
open with the requested delimiter, or whose block is never closed, is a hard
error — sniffing a fence is exactly the shape-guessing AFDATA avoids.
Structs§
- Parts
- Three byte-exact spans of a frontmatter document: the opening delimiter line
(
pre), the frontmatter block handed to the inner backend (frontmatter), and the closing delimiter line plus the body (post). Concatenatingpre,frontmatter, andpostreproduces the original source byte for byte.
Enums§
- Delimiter
- The fence delimiter that brackets a frontmatter block.
Functions§
- split
- Split
sourceinto its frontmatter spans for the given delimiter.