Fast 'YAML' 1.2 Parser and Formatter
Overview
A fast, correct, safe, and ergonomic 'YAML' 1.2 parser and generator written in 'Rust'. Convert between 'YAML' and simple 'R' objects with full support for multi-document streams, tags, anchors, and aliases. Offers opt-in handlers for custom tag behavior and round-trips common 'R' data structures. Implements the 'YAML' 1.2.2 specification from the 'YAML' Language Development Team (2021) https://yaml.org/spec/1.2.2/. Proudly supported by Posit.
- The parser now accepts and ignores reserved directives such as
%***and treats indented---text as part of a multiline plain scalar. parse_yaml()andread_yaml()now preserve tags in thetag:yaml.org,2002:namespace that are not converted to built-in R values as ayaml_tagattribute.parse_yaml()now invokes mapping-key handlers once per key.write_yaml()no longer adds optional document end (...) markers. Written documents still begin with---and end with a newline.format_yaml()andwrite_yaml()now emitInf,-Inf, andNaNas.Inf,-.Inf, and.NaNso they round-trip as doubles (#9).write_yaml()gains anappendargument for adding YAML documents to existing files (#4).
Show all changes in 0.2.0Hide the rest of the changes in 0.2.0
- Replaced the Rust-side R API layer with
savvy/savvy-ffibindings. Source installs now require rustc 1.71 or newer. Vendored Rust crate attribution now points to crate repository metadata when Cargo does not provide crate authors. format_yaml()andwrite_yaml()now emit whole-valued doubles with a decimal suffix (for example,100.0instead of100), so parsing the result preserves their R double type.format_yaml()andwrite_yaml()now automatically wrap long single-line strings and multiline strings containing unindented, single-line paragraphs separated by exactly one blank line. Strings with a safe word boundary are emitted as folded block scalars:>-preserves no final newline, while>preserves exactly one. Paragraph breaks and all other string content round-trip throughparse_yaml()unchanged. The newwidthargument controls the target line width;width = NULLandwidth = Infdisable folded wrapping, mapping keys never use block scalars, and unsafe values use a lossless fallback. Mapping keys longer than YAML's implicit-key limit use explicit mapping syntax.- Multiline literal blocks now use explicit indentation indicators to preserve leading spaces or tabs. They keep physical blank lines empty and preserve later-indented lines. Root literal content is indented so document markers inside a string cannot end the scalar.
format_yaml()andwrite_yaml()now quote strings only when YAML 1.2 requires it. Strings such as"yes","don't","a,b","f[0]", or".gitignore"are emitted as plain scalars (YAML 1.2 has no legacyyes/no/on/offbooleans, and indicator characters only need quoting in positions where they are ambiguous). Strings the YAML 1.2 core schema would read back as null, boolean, or a number (e.g."true","0x1F","0o17",".inf") are still quoted, as are structurally unsafe ones (leading indicators,": "," #", leading/trailing white space, or document-marker prefixes).read_yaml()andwrite_yaml()now expand tilde prefixes (~) inpath, as bypath.expand()(#7).- Fixed source installs on Windows ARM64 by selecting the
aarch64-pc-windows-gnullvmRust target. Windows source installs now also fail early with instructions if the required Rust target is not installed. The README documents that Windows ARM64 source installs also require Microsoft C++ Build Tools with ARM64 components. - Added a benchmarks article comparing read/write performance against the
yamlpackage (#2).
From NEWS.md in the release
Install
Health
- OK13 OK2026-08-04
- NOTE12 OK, 1 NOTE2026-08-01
- OK13 OK2026-07-30
- NOTE12 OK, 1 NOTE2026-07-29
- OK13 OK2026-05-02
Show 4 earlier changesHide 4 earlier changes
- NOTE11 OK, 1 NOTE2026-04-25
- OK14 OK2026-04-16
- NOTE13 OK, 1 NOTE2026-03-28
- OK14 OK2026-03-10
Documentation
The repository also keeps web-only articles.
- Help pages
- 2
- Examples that run
- 100%2 run in a plain check
- Exported functions with examples
- 100%
- Documented parameters
- 100%
- 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
- 56
- 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
Commits over time
Commit identities over time
8 development-tooling and community-health practices detected across 4 families in the upstream repository
Checks run against github.com/posit-dev/r-yaml12 on 2026-10-11.
The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel
GitHub Pages site last deployed 2026-08-26 · The repository has a site deploy workflow
pkgdown site last built 2026-08-25
An outside contributor's pull request to this repository was written with an AI coding tool.
- Claude CodePull requests: 1 from outside contributors, first on 2026-07-07, 1 from forks
Dependencies
Installing yaml12 adds no packages beyond those that come with R.
Code & Tests
People & History
Pick two releases to compare their code metrics.
- 0.2.0Latest
- RR 4.6.0 released · 2026-04-24
- 0.1.02025-12-11
- RR 4.5.0 released · 2025-04-11
Package metadata
- First published
- 2025-12-11
- Total releases
- 2 / 1 yrs
- License
- MIT + file LICENSE OSI
- Minimum R
- ≥ 4.2
- Download size
- 1.6 MB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("yaml12")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-18, which the citation names so these numbers can be found later. More on citing and the projects behind them.