Skip to contents

[Experimental]

Usage

as_inlines(x)

as_blocks(x)

Arguments

x

A character vector, a single inline/block node, a list of nodes, or a pandoc_inlines/pandoc_blocks wrapper.

Value

A pandoc_inlines or pandoc_blocks wrapper.

Details

Smooth over the verbosity of pandoc constructors by accepting plain strings, single nodes, lists of nodes, or already-wrapped sequences, and producing the canonical wrapper type. Inspired by Pandoc Lua filters, where constructors like pandoc.Para("hi") coerce strings to inline sequences automatically.

For as_inlines():

For as_blocks():

These exist as ergonomic shortcuts for use inside ast_filter() handlers and ad-hoc AST construction; the strict-typed constructors (pandoc_inlines, pandoc_blocks, pandoc_str, ...) remain the canonical way to build nodes.

Examples

if (FALSE) { # \dontrun{
pandoc_emph(content = as_inlines("hello world"))
as_blocks(c("first paragraph", "second paragraph"))
} # }