Parse Front Matter from Documents
Overview
Extracts and parses structured metadata ('YAML' or 'TOML') from the beginning of text documents. Front matter is a common pattern in 'Quarto' documents, 'R Markdown' documents, static site generators, documentation systems, content management tools and even 'Python' and 'R' scripts where metadata is placed at the top of a document, separated from the main content by delimiter fences.
format_front_matter()andwrite_front_matter()now infer the delimiter automatically whendelimiter = NULL(the new default). Ifxwas returned byparse_front_matter()orread_front_matter(), the original fence style is preserved; otherwisewrite_front_matter()falls back to the file extension ofpath, and finally to"yaml"(#8).- Added support for shebang lines (
#!) at the start of files. When a file begins with a shebang, the parser now recognizes front matter in comment-wrapped formats (# ---,#' ---) and PEP 723 (# /// script) immediately following the shebang (with zero or one blank lines in between). The shebang line is included in the returnedbody.format_front_matter()andwrite_front_matter()also move a leading shebang line above the front matter block when writing (#5).
Show all changes in 0.3.0Hide the rest of the changes in 0.3.0
- Added SQL front matter support with two comment styles: line comments (
-- ---/-- +++) and block comments in compact (/* ---...--- */) and expanded (/*+---...---+*/) forms. Six new delimiter shortcuts are available forwrite_front_matter():yaml_sql_line,toml_sql_line,yaml_sql_block_compact,toml_sql_block_compact,yaml_sql_block_expanded, andtoml_sql_block_expanded(#4).
From NEWS.md in the release
Install
Health
- OK13 OK2026-08-05
- NOTE12 OK, 1 NOTE2026-08-01
- OK14 OK2026-03-10
Documentation
- Help pages
- 3 (1 internal)includes a package overview page
- Examples that run
- 100%2 run in a plain check
- Exported functions with examples
- 100%
- Documented parameters
- 58%
- Return-value docs
- 100%
- Help pages citing references
- 0%
Downloads
Repository
- PRs merged (all time)
- 100%
- Median days to close, 50 most recently updated closed issues
- 0
- Median days to close, 50 most recently updated closed PRs
- 0
Stars over time
Forks over time
Releases over time
Issues over time
PRs over time
9 development-tooling and community-health practices detected across 5 families in the upstream repository
Checks run against github.com/posit-dev/frontmatter on 2026-10-18.
The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel
GitHub Pages site last deployed 2026-07-05 · The repository has a site deploy workflow
pkgdown site last built 2026-07-05
Show all practicesHide 1 practice
This repository shows signs of AI coding tools.
- Claude Codefirst seen 2026-01-09Seen in the repository: .claude, CLAUDE.mdNamed in .Rbuildignore: .claude, CLAUDE.md
Dependencies
Installing frontmatter adds 4 packages (3 with compiled code, 3.6 MB of source tarballs). Heaviest: yaml12 1.6 MB, tomledit 1.0 MB, rlang 766 KB.
Code & Tests
People & History
Pick two releases to compare their code metrics.
- 0.3.0Latest
- RR 4.6.0 released · 2026-04-24
- 0.2.0
- 0.1.02026-01-14
- RR 4.5.0 released · 2025-04-11
Package metadata
- First published
- 2026-01-14
- Total releases
- 3 / 1 yrs
- License
- MIT + file LICENSE OSI
- Download size
- 145 KB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("frontmatter")This package has no citation file, so citation() returns this entry built from DESCRIPTION.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-21, which the citation names so these numbers can be found later. More on citing and the projects behind them.