What does “Knit HTML” do in Rstudio 0.98?

后端 未结 3 1328
渐次进展
渐次进展 2020-12-11 18:38

I am trying to figure out what command and default options RStudio uses when pressing the \"knit HTML\" button in RStudio version 0.98.1091 because I get a slightly differen

相关标签:
3条回答
  • 2020-12-11 18:40

    As @rawr pointed out in the comments:

    rmarkdown::render('your_document.Rmd', 'html_document', 'new_titel.html')
    

    works and creates the same document as the Knit HTML button.

    0 讨论(0)
  • 2020-12-11 18:41

    I believe it currently uses the html_document function in the RMarkdown package

    0 讨论(0)
  • 2020-12-11 18:51

    When I look at the RMarkdown tab (right of Console tab) it looks like they run knitr::knit and then a fairly involved pandoc shell line

    /usr/local/lib/rstudio/bin/pandoc/pandoc filename.utf8.md --to html --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures --output filename.html --smart --email-obfuscation none --self-contained --standalone --section-divs --table-of-contents --toc-depth 3 --template /home/me/R/i686-pc-linux-gnu-library/3.1/rmarkdown/rmd/h/default.html --variable 'theme:flatly' --include-in-header /tmp/user/1001/RtmpKz5GnI/rmarkdown-str3bba3848bd7b.html --mathjax --variable 'mathjax-url:https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' --no-highlight --variable highlightjs=/home/cd/R/i686-pc-linux-gnu-library/3.1/rmarkdown/rmd/h/highlight

    From the very first /usr/local/lib/rstudio/bin/pandoc/pandoc I infer that they bring their own pandoc, probably figuring duplication is better than debugging to play nice with everyone's idiosyncratic pandoc versions.


    So to me it looks like RStudio is doing the following:

    1. knit
    2. pandoc with their special pandoc version and a lot of flags

    and step #2 is where the interpretation of your header

    ---
    title: "Report Title"
    author: Daddy the Runner
    date:  "`r format(Sys.time(), '%A, %B %d, %Y')`"
    output: 
      html_document:
        keep_md: true
    ---
    

    happens.

    HTH.

    0 讨论(0)
提交回复
热议问题