Closed cderv closed 2 years ago
We could also try to recreate a "gfm_format". There is one unused internally in rmarkdown:::gfm_format()
but as GFM does not really handle math, it does not either
xfun::write_utf8(c(
"---",
"title: test",
"---",
"",
"$e^{i \\pi}$",
"",
"$\\frac{e^{i \\pi}}{10}$",
""
), "test.Rmd")
# With Pandoc 2.7 (RStudio 1.3)
pandoc_2.7 <- fs::path_home("Logiciel/pandoc/pandoc-2.7.3")
rmarkdown::find_pandoc(cache = FALSE, dir = pandoc_2.7)
#> $version
#> [1] '2.7.3'
#>
#> $dir
#> [1] "C:/Users/chris/Logiciel/pandoc/pandoc-2.7.3"
res <- rmarkdown::render("test.Rmd", rmarkdown::md_document(rmarkdown:::gfm_format()),
quiet = TRUE)
xfun::file_string(res)
#> *e*<sup>*i**p*</sup>
#>
#> $\\frac{e^{i \\pi}}{10}$
# With Pandoc 2.11 (RStudio 1.4)
rmarkdown::find_pandoc(cache = FALSE, version = "2.11.3.2")
#> $version
#> [1] '2.11.3.2'
#>
#> $dir
#> [1] "C:/Users/chris/scoop/shims"
res <- rmarkdown::render("test.Rmd",
rmarkdown::md_document(rmarkdown:::gfm_format()),
quiet = TRUE)
xfun::file_string(res)
#> *e*<sup>*i**p*</sup>
#>
#> $\\frac{e^{i \\pi}}{10}$
I think the best way will be to support --webtex
for github_document
format. This should be an extension of the work in #1940
It seems that pandoc now wants to really enforce the use of gfm
over markdown_github
, as I am seeing a warning (e.g. in pkgdown vignettes):
[WARNING] Deprecated: markdown_github. Use gfm instead.
Yes markdown_github
will probably disappear in future versions of Pandoc.
pkgdown will switch to gfm
to fix the warning (https://github.com/r-lib/pkgdown/pull/1473).
rmarkdown already use gfm
for pandoc 2.0+
https://github.com/rstudio/rmarkdown/blob/44d7b1093b46bd3cee217ba13cabdf8bc60e1783/R/github_document.R#L41-L46
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.
This is following observation on https://github.com/rstudio/rmarkdown/issues/1886 and it is related. Opening the issue just to track the change than happened between Pandoc version
How does it look with
github_document
?Created on 2021-01-07 by the reprex package (v0.3.0.9001)
I don't think there is an extension so that the new
gfm
output as the old one, becausetex_math_single_backslash
is not supported bygfm
, orcommonmark
or evencommonmark_x
.It seems that the default behavior Pandoc 2.7 was to transform the math to single backslash even if the extension was already deactivated.
Possible option I see:
tex_math_dollars
to gfm so that it output with$..$
--webtex
forgithub_document
output so that math are rendered as images in the md file. (discussed in #1886)