Arguments
- x
A
pandoc,pandoc_node,pandoc_blocks,pandoc_inlines, or list thereof.
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:
pandoc_str,pandoc_code,pandoc_math,pandoc_raw_inline,pandoc_raw_block,pandoc_code_blockemit their@textslot.pandoc_spaceandpandoc_soft_breakemit a single space.pandoc_line_breakemits a newline.pandoc_horizontal_ruleemits a newline.
Container rules:
Block containers (
pandoc,pandoc_div,pandoc_block_quote, list types, etc.) join children with two newlines.Inline containers (
pandoc_emph,pandoc_strong,pandoc_link, etc.) concatenate children without separator.pandoc_noteemits its block content (joined with newlines) wrapped in[^...]to flag it; rarely useful in match logic.
Examples
if (FALSE) { # \dontrun{
doc = parse_qmd("# Hello *world*\n\nSecond paragraph.\n")
ast_text(doc)
# "Hello world\n\nSecond paragraph."
} # }