downlit
downlit copied to clipboard
consider --standalone output
According to the pandoc documentation, yaml metadata is only written to markdown output if --standalone
is used:
When pandoc is used with -t markdown to create a Markdown document, a YAML metadata block will be produced only if the -s/--standalone option is used. All of the metadata will appear in a single block at the beginning of the document.
As a result, downlit::downlit_md_path()
discards YAML metadata when run on markdown files. This prevents me from performing markdown -> downlit -> markdown conversions.
The result of setting --standalone is:
When the -s/--standalone option is used, pandoc uses a template to add header and footer material that is needed for a self-standing document. To see the default template that is used, just type
pandoc -D *FORMAT*
If I call system2(rmarkdown::pandoc_exec(), "-D gfm")
or system2(rmarkdown::pandoc_exec(), "-D markdown_github")
, I get a barebones template which should not otherwise affect the md output.
$if(titleblock)$
$titleblock$
$endif$
$for(header-includes)$
$header-includes$
$endfor$
$for(include-before)$
$include-before$
$endfor$
$if(toc)$
$table-of-contents$
$endif$
$body$
$for(include-after)$
$include-after$
$endfor$