Skip to contents

[Experimental]

Usage

ast_text(x, ...)

Arguments

x

A pandoc, pandoc_node, pandoc_blocks, pandoc_inlines, or list thereof.

Value

A single character string.

Details

Recursively concatenates the textual content of a pandoc AST, dropping all formatting. The output of a parse_qmd() result fed back through ast_text() is roughly what readers would see if the document were rendered as a flat string.

Equivalent in spirit to pandoc.utils.stringify() from Pandoc Lua filters: handy for matching on document content (titles, captions, link labels) without descending the AST manually.

Leaf rules:

Container rules:

Examples

if (FALSE) { # \dontrun{
doc = parse_qmd("# Hello *world*\n\nSecond paragraph.\n")
ast_text(doc)
# "Hello world\n\nSecond paragraph."
} # }