Open tjmahr opened 3 years ago
I am running into similar issue here except in the context of HTML. I am using downlit to add autolinking to a rendered html document. It is only a partial html file but downlit adds the <html><body>
tags
This is an excerpt of my current code. The output of pandoc does not have the
tags, but using downlit adds them.# render the section alone
rmarkdown::render(
tmp,
rmarkdown::github_document(),
out_md
)
tmp_out <- tempfile(fileext = ".html")
# convert to html
pandoc::pandoc_convert(
out_md,
to = "html",
output = tmp_out,
standalone = FALSE
)
# apply auto-linking
downlit::downlit_html_path(
tmp_out,
tmp_out,
downlit::classes_pandoc()
)
According to the pandoc documentation, yaml metadata is only written to markdown output if
--standalone
is used: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:
If I call
system2(rmarkdown::pandoc_exec(), "-D gfm")
orsystem2(rmarkdown::pandoc_exec(), "-D markdown_github")
, I get a barebones template which should not otherwise affect the md output.