Details
to_qmd() is the single entry point for turning an R-held AST back
into QMD source text. Two top-level methods are defined:
to_qmd(pandoc)rebuilds pampa'sPandocvalue in Rust from the tagged-list shape produced bypandoc_to_list()and runspampa::writers::qmd::writeon it. Pampa is the sole source of truth for QMD writing.to_qmd(ts_tree)recovers source bytes by walking the tree-sitter AST and falling back to each node's@textslot where children don't cover all of the parent's bytes (grammar gaps). This is byte-recovery, not "writing" - a tree-sitter AST already represents source bytes, and pampa exposes no publicts_ast -> Pandocconversion that we could invoke independently of its reader.
On the pandoc side only whole-document dispatch is supported: there is
no method for an individual block or inline (wrap a fragment in a
minimal pandoc and route it through pampa). The tree-sitter side is
pure byte-recovery, so it also dispatches on a single ts_node.