Parse an assignment document into a Pandoc AST
Source:R/utils_parsing.R
parse_assignment_document.RdReads a qmd document, normalizes any knitr-style chunk headers so the
Quarto parser accepts them, and parses it into a q2r pandoc AST.
Details
Parse diagnostics are surfaced rather than stripped: error-kind
diagnostics from q2r are raised as R errors. Warning-kind diagnostics
are not signaled (they would otherwise print to the console from inside
the apps); they stay attached to the returned AST's @diagnostics slot,
labeled with the document's file name, and mark(), template() and
parse_project() report them. Rewriting a knitr-style chunk header adds
lines, so a diagnostic whose line number moved carries a hint giving the
line of the file as written. If parsing yields an empty AST (no blocks)
an error is reported.