-
Improved highlighting theme
arrowregarding accessibility. -
Fixed an issue with
site_generator()detection of a site project (thanks, @bhattmaulik, #2344). -
Fixed an issue with Shiny prerendered documents and Pandoc not correctly rendering last Markdown paragraph in HTML (thanks, @gadenbuie, #2336).
-
Fixed a bug that
site_generator()fails to detect the root dir of the site and causes infinite recursion (thanks, @fisher-j, #2339). -
html_vignette()gainscode_foldingargument (thanks, @atusy, #2340). -
html_document()can opt-outcode_folding = "show"or"hide"for individual code blocks by adding thefold-noneclass to the code blocks (thanks, @atusy, #2348). -
When using a development version of Pandoc, a
.9999suffix is appended to version number so thatpandoc_available()can correctly compared version with last release.
-
Fix an issue with older R version and vignette building (#2324).
-
Fix an issue with older R version and
preserve_yaml = TRUEinmd_document()(#2325). -
Long title in
ioslides_presentationfailed to work with Pandoc 2.17.x (thanks, @Am386DX-40, #2327).
-
html_document()andhtml_document_base()gains themath_methodargument to support all the math rendering engines from Pandoc: "mathjax", "katex", "mathml", "webtex", and "gladtex". For backward compatibility, themathjaxargument still works and will take precedence overmath_method, but we recommend using the newmath_methodargument instead of themathjaxargument, and the latter could be deprecated in the future.You can specify a math engine via
math_methodas an engine name, e.g.,output: html_document: math_method: katex
or provide both a name and a URL (for
mathjax,katexandwebtex):output: html_document: math_method: engine: mathjax url: https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml-full.js
For
math_method = "katex", KaTeX CDN will be inserted in version 0.15.2 by default (from jsdelivr). A custom URL toward another CDN can be passed asurl.For
math_method = "webtex", it will default to inset SVG usinghttps://latex.codecogs.com/svg.image?. Usehttps://latex.codecogs.com/png.image?for PNG. See https://latex.codecogs.com for supported options (dpi, background, ...).Most HTML output format using
html_document()orhtml_document_base()as based format should benefit from this new feature.
See?rmarkdown::html_document()for details (thanks, @atusy, #1940). -
github_document()also gains themath_methodargument set to"webtex"by default so that LaTeX equations can be rendered in the Github Markdown document as images. Previously, LaTeX equations were not rendered. Setmath_method = NULLto deactivate. -
Added support for katex R package as a math engine with
math_method = "r-katex"in HTML documents. This method offers server-side rendering of all the equations, which means no JS processing is needed in the browser as with usual KaTeX or MathJaX methods. (thanks, @jeroen, #2304). -
anchor_sectionscan now be easily customized usingstyleordepthelement foranchor_sections. For example:output: html_document: anchor_sections: style: symbol # use symbol style ("hash", "symbol", "icon") depth: 2 # max depth to apply anchor on (default to max which is 6)
Customizing using a CSS rule is still possible. Detailed explanation and examples have been added to the help page
?html_document. -
Improved the highlighting mechanism in formats that supports
highlightargument:- It is now possible to pass a custom theme file
.themeinhighlightargument for customizing the syntax highlighting style used by Pandoc. - In addition to Pandoc's own supported themes, two more themes are bundled in the package:
highlight: arrowa theme optimized for accessibility and color constrast (thanks to @apreshill), andhighlight: rstudioto mimic the RStudio editor theme. - For HTML output only, added optional downlit support in
html_document()for R syntax highlighting and autolinking. Usehighlight_downlit = TRUEto activate it (same argument as in distill). This features require the downlit package.
- It is now possible to pass a custom theme file
-
Templates for
html_document()andioslides_presentation()gained a new CSS rule to display single line<summary>content inline (rstudio/rstudio#10589). -
md_document()gained a newstandaloneargument, which isFALSEby default unlesstoc = TRUE. This allows to output authors, date and other metadata per the Pandoc's template. Due to limitation in how Pandoc is handling metadata blocks in its extensionsyaml_metadata_block,preserve_yaml = TRUEnow deactivate any extension to let rmarkdown directly handle the keeping of YAML block - this means it does not setstandalone = TRUEby default. Meanwhile,github_document()gained thepreserve_yamlargument (thanks, @florisvdh, #2297). -
Added
available_templates()to list all the templates from a specific package that can be used withrmarkdown::draft(). -
Following support in Pandoc 2.15,
powerpoint_presentation()gained aincrementalargument as other slide formats. As a reminder, settingincremental = TRUEwill make lists to display incrementally. See more in Pandoc's MANUAL. -
Added support for Pandoc's
dirvariable in HTML templates. This is the second Language Variables afterlang. -
Added a global option
rmarkdown.html_dependency.header_attr(TRUEby default). It can be set toFALSEto opt-out the HTML dependencyhtml_dependency_header_attrs()in documents based onhtml_document_base()(thanks, @salim-b rstudio/bookdown#865, @maelle r-lib/downlit#1538). -
Rendering using
runtime: shiny_prerenderedorruntime: shinyrmdnow natively supports custom templates. Previously since 2.8, developers had to add a special comment,<!-- HEAD_CONTENT -->, conditionally toshiny-prerenderedvariable. (See also NEWS from 2.8 for the previous behavior). The new behavior inserts required special comment<!-- HEAD_CONTENT -->as a last element of$header-includes$. If templates rely on the old behavior and require some contents between$header-includes$and<!-- HEAD_CONTENT -->, consider including them with$header-includes$(thanks, @atusy, @gadenbuie #2249). -
A shiny prerendered document with only a empty server context does not error anymore. Document will be rendered with a empty server function and
server.Rfile will be ignored. To useserver.R, no server context should be present in the Rmd document (thanks, @jcheng5, #2305). -
Fixed a regression with rendering
shiny_prerendereddocument (thanks, @aronatkins, @gadenbuie, #2218). -
Fixed an issue in
beamer_presentation()whereheader-includeswould be overwritten byincludes = list(in_header =)(thanks, @samcarter, #2294). Same fix as forpdf_document()(#1359). -
Fixed broken links to section headers when
number_sections = TRUEis specified inmd_documentandgithub_document(thanks, @atusy, #2093). -
draft()now works withdevtools::load_all()and testthat when used in other packages. -
Lua Filters: Added two more functions in
shared.luafor other package to use:- Added
type()function backward compatible following Pandoc 2.17 changes. - Added
print_debug()for easier logging during debug.
- Added
-
Relative paths in parent directories in the
cssargument ofhtml_document()were incorrectly normalized to absolute paths by #2095 in v2.8. Now relative paths in parent directories will no longer be converted to absolute paths (thanks, @daijiang, yihui/xaringan#331). -
It is possible to specify the version of jQuery via a global option now, e.g.,
options(rmarkdown.jquery.version = 2)(note that the default major version is3). This is mainly for advanced users and developers to test different versions of jQuery. -
pandoc_citeproc_convert()now handles correctly bib file containing specific UTF-8 characters on non default UTF-8 systems like Windows (thanks, @mitchelloharawild, #2195). -
Shiny prerendered documents are now pre-rendered in a child environment to avoid allowing the results of static code chunks to exist in the Shiny app environment (@gadenbuie, #2203).
-
The previously unexported function
convert_ipynb()is exported now (thanks, @acircleda).
-
md_document()will now handle correctlypreserve_yamlvalue for all variants and all pandoc versions (#2190).- with
preserve_yaml = TRUE, markdown output will keep the YAML metadata block from the Rmd file. - with
preserve_yaml = FALSE, markdown output will have no YAML metadata block.
This fixes a breaking change in Pandoc 2.13 regarding
gfm,commonmarkandcommonmark_xwhich now supportsyaml_metadata_blockby default (#2118). - with
-
New supported syntax for Shiny prerendered documents: you can now use
server: shinyorserver: type: shiny. -
Ability to inject additional functions into Shiny prerendered server scope using the "server-extras" context.
-
Fixed the syntax highlighting issue with R's pipe operator
|>(thanks, @edzer, rstudio/bookdown#1157).
-
Fix a regression in version 2.8 when a url is used in
cssargument (thanks, @vnijs, #2163). -
All HTML dependencies are now correctly supported, included those with only an
hrefcomponent but notfilecomponent in theirsrcattribute. Previously, rmarkdown would throw the error'path for html_dependency not provided'when rendering documents containing HTML dependencies withhrefcomponents (thanks, @crazycapivara, @matthewstrasiotto, #1805, #1948, #2151). -
Fix an error thrown with output format using a
file_scopefunction (like in bookdown) (thanks, @rfaelens, #2149). -
Fix an issue with
copy_ressource = TRUEinhtml_document_basewhere very long HTML documents were truncated during post processing (thanks, @oliviermeslin, #2145). -
When
run()-ing aruntime: shinydocument, an extra temp folder will be used in the output path. With the extra temp random folder in the path, predictable output file names may be used. (#2137) -
When
run()-ing aruntime: shinydocument with a{bslib}theme, the global theme value wasn't being restored properly. (#2160) -
Floating ToC in
html_documentcan now hide headings with unnumbered and unlisted classes (thanks, @atusy, #1993). -
Fix prefix handling in R Markdown website's navbar for Fontawesome V5 and compatibility with V4. For icon only available in V5, the full prefix + name should be use, especially with new
fabprefix (e.g.fab fa-r-project). If no prefix is used (e.gfa-homeinstead offas fa-home), thefaprefix will be added for V4 compatibility as it has been deprecated in V5. We advice to use the full prefix + name for icons following Fontawesome documentation. (#1994) -
rmarkdown::site_generator()can hang session waiting for input when thesitefield is not found in the YAML frontmatter ofindex.Rmd(thanks, @kevinushey @mirh, #2043).
-
Fix a issue with Pandoc 2.5 and
latex-div.lua- documents can now be rendered as expected without error (thanks, @davidwales, #2121). -
Fix an issue with styling and code folding button behavior when default is
code-folding: show. The Button can now be correctly style according to state asaria-expandedattributes is correctly updated. Also, new classes has been added on the button to allow styling during transition:btn-collapsingandbtn-expandingare respectively applied during transition Show to Hide and Hide to Show. (This follow Bootstrap behavior for the collapsible block) (thanks, @steveharoz, #2085). -
Fix an issue with
citation_packagehaving no effect when using.mdfile as input torender()with latex and PDF output formats (thanks, @andrewheiss, #2113). -
A new internal option
rmarkdown.knit.exthas been added to control the extension of the intermediary knit output during a rendering. It defaults tomdto produce*.knit.md. Only useful for very advanced usage (#2098). -
render()won't produce any*.utf8.mdintermediary file anymore. This was a leftover from previous versions of rmarkdown. Since knitr 1.24 and rmarkdown 2.0, only UTF-8 input files are allowed. (#2098). -
Fix an
Invalid cross-device linkerror whentempdir()is used forintermediates_dirinrender()(thanks, @gorgitko, #2096). -
Fix a regression in HTML default template with floating toc incorrectly placed on small size window (thanks, @grimbough, #2071)
-
Provided a
runtime: shinyfix for output formats that pass a modifiedbslib::bs_theme()object tohtml_document_base()'stheme(thanks, @cpsievert, #2049). -
Rendering using
runtime: shiny_prerenderedorruntime: shinyrmdwill now produce valid HTML by not inserting anymore the full document as body in the resulting shiny apps (thanks, @dakep, #1912). Header content usually containing html dependencies will be inserted in the HTML document at the end of the head before</head>, unless the rendered HTML contains<!-- HEAD_CONTENT -->special comment (seehtmltools::renderDocument()). A new Pandoc variable is set in for shiny prerendered document to allow conditional insertion of such content in the the HTML template using$if(shiny-prerendered)$. This has been done in all HTML template in this package. Users of custom template should make this change to provide support for this runtime. See rmarkdown default template (default.html) for an example (#2064). -
Added
tectonicas a supported LaTeX engine for generating PDF output (thanks, @dpryan79, #2078). You can specify to use this by addingengine: "tectonic"to your output format in YAML, such aspdf_document. -
When no
output_formatis provided in any way but anoutput_fileis provided inrender(), the default format will be determined based on the extension:"pdf_document"for.pdf, or"word_document"for.docx. Otherwise, it will be"html_document"as previous version (thanks, @pearsonca, #1569). -
Added a new global option
rmarkdown.render.message. When setFALSE,render()will not output the message starting byOutput created:allowing RStudio IDE to open a preview of the document. This is useful for package developers that would need to emit there own output message for there custom format. See?render_sitefor more info on this special message (#2092). -
Internal changes regarding Lua filters. They have now an explicit Pandoc version minimal requirement: A filter will be skipped with a warning printed by the Lua filter if this requirement is not met. For now, all filters work for Pandoc 2.1 and above (thanks, @atusy, #2088). There is also now a new mechanism to have a share Lua filter script loadable by other Lua files:
render()will set theRMARKDOWN_LUA_SHAREDenv var to the path of Lua filtershared.luaso that other filters can access functions defined in it usingdofile(os.getenv 'RMARKDOWN_LUA_SHARED'). This is for internal usage only to avoid duplication (thanks, @tarleb, #2103). -
html_document_basegains acssargument, to whichhtml_document'scssargument is now passed. This also fix an issue when.sassor.scssfiles are used with thiscssargument whenself_contained: FALSE. Moreover, sass caching mechanism can now be used when passing.sassor.scssfiles to thecssargument (thanks, @cpsievert, #2095). -
The
fig_cropoption of PDF document formats (such aspdf_documentandbeamer_presentation) supports the value"auto"now, which meansfig_crop = TRUEwhen figure cropping toolspdfcropandghostscriptare available. -
The default value of the
fig_cropoption of PDF output formats has been changed fromTRUEto"auto"(#2077). -
rmarkdown::tufte_handouthas been deprecated and will be removed in the future from this package. It has been moved to the tufte package since rmarkdown 0.9.5 (released on 2016-02-22). Please usetufte::tufte_handoutinstead.
-
html_document(andhtml_document_base)'sthemeparameter now understandsbslib::bs_theme()objects/arguments, meaning that one may opt-into Bootstrap 4 and more easily create custom themes. For examples, see #1706, and for context, see https://rstudio.github.io/bslib/ (thanks, @cpsievert, #1706). -
Files with
.scss/.sassextension (i.e., Sass files) provided tohtml_document'scssparameter are now compiled to CSS using the{sass}package. Also, ifthemeis a{bslib}object, these Sass files may utilize Sass code inside thetheme(thanks, @cpsievert, #1706). -
Fix an issue with line numbering in code chunks when
.numberlineswith Pandoc's highlighting (thanks, @aosavi, #1876). -
Fix an issue with shiny runtime and
global.R(thanks, @liaojiahui-r, rstudio/flexdashboard#298). -
Accept
latex="{options}",latex=1, orlatex=truefor Latex Divs. -
Add
output_format_filterfunction todefault_site_generator(). Enables custom site generators to customize or even entirely replace the output format right before rendering of each page. -
Automatically exclude renv directory for
render_site()(thanks, @jmbuhr, #1996) -
Do not force
options(htmltools.preserve.raw = TRUE)when this option has been set, otherwise it is impossible for other packages to turn this option off, e.g., yihui/xaringan#293. -
knitr_options_pdf()will now throw a warning whenfig_crop = TRUEbut is disabled because required toolspdfcropand/orghostscriptare missing (thanks, @netique, #2016). -
Eliminated the unnecessary padding in code blocks in the
html_documentoutput with Bootstrap 4 themes (thanks, @atusy, #2019). -
github_document()will produce a working TOC even if some headers start with number (#2039). -
Fix an issue with
knit_print.data.frame. The...arguments are no more passed toprint()to avoid passingknit_print()argumentsoptionsandencodingto customprint()methods (#2047).
-
Encoding is correctly handled now in
html_vignettewhen checking for identical title and vignette index entry (thanks, @py-b, #1978). -
clean_site()now default topreview = TRUEand will no more remove files without notice. This change will affect the "Clean All" button in the "Build" pane for website project.clean_site(preview = FALSE)must be run to effectively remove files (#1973). -
The intermediate
.texfile is now correctly deleted ifkeep_tex = FALSEwhen the R Markdown document is not rendered from the working directory (thanks, @vqv, #1308). -
Fix a bug causing certain resources files to be deleted as intermediate files when
intermediates_diris the same as the input (thanks, @bellma-lilly, #1248). -
Fix issues with
anchor_sections = TRUEand learnr (thanks, @gadenbuie, #1938). -
Enable use of
server.Randglobal.Ralongsideruntime: shinyrmddocuments. -
pkg_file_lua()now works withdevtools::load_all()and testthat when used in other packages. -
Fix
pandoc_convert(citeproc = TRUE)not supressing the--natbibor--biblatexoptions (thanks, @atusy, #1932). -
pandoc-citeprocis now activated if abibliographyfield is defined in another YAML block instead of the first YAML block (thanks, @bwiernik, #1364). -
Specify that
htmltools::htmlPreserve()should use the pandoc raw attribute
rather than preservation tokens when pandoc >= v2.0. Note that this option will
have the intended effect only for versions of htmltools >= 0.5.0.9003. -
anchor_sectionsinhtml_documents()now defaults toFALSE. It was introduced in previous version with a default toTRUE, but it is reverted now after hearing feedbacks from the community (thank you!). The#is still used as the character for the anchor but you can easily change that using CSS rules. Examples have been added to the help page?html_document. -
Using Pandoc's default for
--email-obfuscationnow. Previously, it was set tononeexplicitly, which is the default for Pandoc 1.17.2+ anyway. Only users with a Pandoc version before 1.17.2 may see a change in the content of the html source file produced if the document contains email addresses. This change allows to pass the Pandoc's command line flag if you want to set it to another value (thanks,@seankross, #1969).output: html_document: pandoc_args: ["--email-obfuscation", "javascript"]
See Pandoc's manual for the meaning of this option.
-
Tables without header rows (wich can be possible in Pandoc's simple table) are now formatted correctly when using
html_document()format (thanks, @fkohrt, #1893). -
html_documentgains theanchor_sectionsargument, which isTRUEby default, so that readers can get links to section headers easily---when you mouse over a section hader, you will see a hash symbol#at the end of the header, which contains the anchor link to this header. You can click on this link and get the URL in the addres bar of your web browser, or right-click on it and copy the URL from the context menu. The hash symbol is defined by the CSS rulea.anchor-section::before {content: '#';}. You can customize it by overriding this rule (e.g., via thecssargument ofhtml_document) and use any other symbols or icons, e.g.,content: "\02AD8;"(thanks, @atusy, #1884). -
pkg_file_lua()should have thrown an error if the expected Lua file does not exist. -
Provide
files_dirandintermediates_diras attributes on return fromrender()whenrun_pandoc = FALSE. -
Supports new Pandoc 2.11
--citeprocflags usage instead ofpandoc-citeprocexternal filter.pandoc_convert()andpandoc_citeproc_convert()will now use the correct flags according to the Pandoc version used. The logic is exported inpandoc_citeproc_args(). See Pandoc release note for more information about the newciteprocprocessing (#1916). -
Fixed the code highlighting when code block is hidden. Previous version introduced a regression where non default code highlighting was still shown when
code_foldingis activated and code block is hidden (thanks, @matthewcarlucci, #1921). -
The minimal required version for the xfun package (v0.15) has been specified for R Markdown Notebooks to work properly (thanks, @jmcphers, #1923).
-
Fixed a bug in
convert_ipynb()when the language is not specified in the.ipynbfile (thanks, @acca3003, #1925). -
Introduce
runtime: shinyrmdas a more user friendly alias forruntime: shiny_prerendered.