microsoft / RTVS

R Tools for Visual Studio.
MIT License
390 stars 118 forks source link

Knitting R Markdown to HTML fails with pandoc 2.x #4273

Closed mhmdmodan closed 6 years ago

mhmdmodan commented 6 years ago

Slightly misleading, actually knitting to markdown itself looks like it works fine, but converting with pandoc to HTML is what raises the issue. Works fine for word. Seems in pandoc 2.x, the argument --smart has been removed in favor of +smart/-smart.

image

Here's the full error when knitting to HTML:

processing file: rmd_10c84bfc4fab.rmd
  |.................................................................| 100%
  ordinary text without R code

output file: rmd_10c857bb4c44.knit.md

"C:/Users/mhmdm/AppData/Local/Pandoc/pandoc" +RTS -K512m -RTS rmd_10c857bb4c44.utf8.md --to html --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output pandoc10c8224733f.html --smart --email-obfuscation none --self-contained --standalone --section-divs --template "C:\Users\mhmdm\Documents\R\win-library\3.4\rmarkdown\rmd\h\default.html" --no-highlight --variable highlightjs=1 --variable "theme:bootstrap" --include-in-header "C:\Users\mhmdm\AppData\Local\Temp\RtmpuaXowu\rmarkdown-str10c839a41c8a.html" --mathjax --variable "mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" 
--smart/-S has been removed.  Use +smart or -smart extension instead.
For example: pandoc -f markdown+smart -t markdown-smart.
Try pandoc.exe --help for more information.
Error: pandoc document conversion failed with error 2
In addition: Warning message:
running command '"C:/Users/mhmdm/AppData/Local/Pandoc/pandoc" +RTS -K512m -RTS rmd_10c857bb4c44.utf8.md --to html --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output pandoc10c8224733f.html --smart --email-obfuscation none --self-contained --standalone --section-divs --template "C:\Users\mhmdm\Documents\R\win-library\3.4\rmarkdown\rmd\h\default.html" --no-highlight --variable highlightjs=1 --variable "theme:bootstrap" --include-in-header "C:\Users\mhmdm\AppData\Local\Temp\RtmpuaXowu\rmarkdown-str10c839a41c8a.html" --mathjax --variable "mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"' had status 2 

This can be remedied in the RMD however by setting smart to false in the header.

output:
    html_document:
        smart: false

Knitting/conversion works fine with pandoc 1.19.2.1

mkoohafkan commented 6 years ago

Does this work with RStudio or regular R GUI? Last I checked knitr release didn't support Pandoc v2 yet. I think there's also some stupid stuff that can happen with assumed Pandoc paths in knitr/rmarkdown packages. There was a SO post about it a little while ago but I can't seem to find it.

MikhailArkhipov commented 6 years ago

https://stackoverflow.com/questions/45339538/error-pandoc-document-conversion-failed-with-error-2-with-pkgdown-rmarkdown

MikhailArkhipov commented 6 years ago

We don't invoke Pandoc directly, we actually use rmarkdown package, same as RStudio.

MikhailArkhipov commented 6 years ago

Also, RS has same issue https://support.rstudio.com/hc/en-us/community/posts/115000885267-Rmarkdown-defaults-fail-because-of-Pandoc