yaml_body: Partition the YAML metadata and the body in a document

View source: R/yaml.R

yaml_bodyR Documentation

Partition the YAML metadata and the body in a document

Description

Split a document into the YAML metadata (which starts with ⁠---⁠ in the beginning of the document) and the body. The YAML metadata will be parsed.

Usage

yaml_body(x, ...)

Arguments

x

A character vector of the document content.

...

Arguments to be passed to yaml_load().

Value

A list of components yaml (the parsed YAML data), lines (starting and ending line numbers of YAML), and body (a character vector of the body text). If YAML metadata does not exist in the document, the components yaml and lines will be missing.

Examples

xfun::yaml_body(c("---", "title: Hello", "output: litedown::html_format", "---",
    "", "Content."))

xfun documentation built on Nov. 1, 2024, 1:06 a.m.