-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pandoc versions 2.13+ include the yaml header in the output for GFM #375
Comments
Cc @cderv Is this going to have effects beyond reprex in the knitr-verse and I can maybe rely on it getting "fixed" in knitr? (Caveat: this is a quick reaction to this issue, not based on actual exploration yet.) |
Yes I think we need to cover this new case in We don't have issue with Thanks for the ping. |
Sorry if it should be clear but ... do you think I will need to deal with this explicitly in reprex then? |
To answer that it required a deeper look. The bottom issue is because So on rmarkdown side I think the correct fix is that However, on reprex side, I think you will need to deal with it even with a fix in rmarkdown because you are not using Lines 113 to 117 in d6b12e4
This means that you inherit the argument for Pandoc for the default behavior of md_document() which is equivalent to md_document(variant = "markdown_strict") and this insert the --standalone arg you don't want. That is what is causing the issue.
In the first place, I think reprex should use If you want a workaround in the meantime without waiting for a new rmarkdown version, I think you can deactivate the extension in your format directly and that would work diff --git a/R/reprex_document.R b/R/reprex_document.R
index 9d5a991..16740c5 100644
--- a/R/reprex_document.R
+++ b/R/reprex_document.R
@@ -116,7 +116,7 @@ reprex_document <- function(venue = c("gh", "r", "rtf", "html", "slack", "so", "
opts_chunk = opts_chunk
),
pandoc = rmarkdown::pandoc_options(
- to = "gfm",
+ to = paste0("gfm", if (rmarkdown::pandoc_available("2.13")) "-yaml_metadata_block"),
from = rmarkdown::from_rmarkdown(implicit_figures = FALSE),
ext = ".md",
args = pandoc_args |
With pandoc 2.12 this works as expected.
With pandoc 2.13 we get the YAML header as well
Created on 2021-04-28 by the reprex package (v2.0.0)
It looks like this is fallout from jgm/pandoc#6537, pandoc now parses the YAML header for GFM, before it was silently discarded.
I think likely reprex will have to either remove the header from the input file it sends to pandoc, or remove it from the output after the fact.
The text was updated successfully, but these errors were encountered: