repomatic.frontmatter module¶
Splitting a Markdown document into its YAML frontmatter and body.
Two unrelated families of bundled Markdown carry frontmatter: skill definitions
(SKILL.md, whose fields the Agent Skills
spec defines) and PR body templates in
repomatic/templates/. Both need the same split, so it lives here once rather
than once per consumer.
- repomatic.frontmatter.DELIMITER = '---'¶
Line that opens and closes a frontmatter block.
- repomatic.frontmatter.split_frontmatter(raw)[source]¶
Split a document into its parsed frontmatter mapping and its body.
Values keep their YAML types, so a nested field (the spec’s
metadatamapping, a template’sargslist) reads back as the structure it was written as rather than a flat string.Note
Both delimiters must sit alone on their own line, per the frontmatter convention. Scanning for the closing line, instead of splitting the document on the first two
---runs, keeps a value that embeds---(like anargument-hintlisting a long-form option) from truncating the block.- Parameters:
raw (
str) – Full text of the document.- Return type:
- Returns:
(frontmatter, body). The frontmatter is an empty mapping when the document opens no block, leaves one unterminated, or holds something other than a YAML mapping; in each of those cases the body is raw unchanged, so no content is ever silently dropped.