A.2 Pandoc y RMarkdown
Como ya se comentó, el paquete rmarkdown
llama a pandoc para renderizar un documento RMarkdown9, y esta llamada se muestra en la consola (o en la correspondiente pestaña de RStudio):
"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS Informes.utf8.md --to html4
--from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash
--output Informes.html --smart --email-obfuscation none --self-contained --standalone
--section-divs --table-of-contents --toc-depth 3 --variable toc_float=1
--variable toc_selectors=h1,h2,h3 --variable toc_collapsed=1 --variable toc_smooth_scroll=1
--variable toc_print=1 --template "C:\PROGRA~1\R\R-35~1.1\library\RMARKD~1\rmd\h\DEFAUL~1.HTM"
--no-highlight --variable highlightjs=1 --variable "theme:bootstrap" --include-in-header
"C:\Users\RUBEN~1.FCA\AppData\Local\Temp\RtmpkntXD8\rmarkdown-str2084caf51da.html" --mathjax
--variable "mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"
Output created: Informes.html
La mayoría de los campos de la cabecera YAML de un fichero RMarkdown se traducen en las opciones de Pandoc. Por ejemplo, la cabezera:
---
output:
html_document:
number_sections: yes
---
(que produce la numeración de secciones y subsecciones),
se corresponde con la opción --number-sections
de pandoc.
También se puede establecer cualquier opción de Pandoc en la cabecera YAML
mediante el campo pandoc_args
, por ejemplo:
---
output:
html_document:
pandoc_args: ["--number-offset", "4,0", "--number-sections"]
---
(en este caso la numeración comenzaría en 4).
Xie, Yihui. 2021. Knitr: A General-Purpose Package for Dynamic Report Generation in r. https://yihui.org/knitr/.
Xie, Yihui, JJ Allaire, and Garrett Grolemund. 2018. R Markdown: The Definitive Guide. CRC Press. https://bookdown.org/yihui/rmarkdown/.