rmarkdown icon indicating copy to clipboard operation
rmarkdown copied to clipboard

offer a HTML5 compatible format as `html_document()` is HTML4 only

Open UlvHare opened this issue 5 years ago • 6 comments

There is a quite old commit forcing rmarkdown --> pandoc to render all html documents as html4. Mostly I use my own html5 templates but even putting in YAML something like:

---
title: "My title"
date: "`r Sys.time()`"
output:
  html_document:
    fig_width: 8
    fig_height: 6
    toc: true
    theme: null
    highlight: "pygments"
    md_extensions: -autolink_bare_uris
    self_contained: FALSE
    template: journal.html5
    pandoc_args: ["--to=html5"]
---

there is --to html4 in output meaning that pandoc uses it. The only working solution is manually "revert" those strings in rmarkdown sources locally and rebuild it at every update. And when I need to use e.g. bookdown, which relies on (deprecated?) html4, I install CRAN version again. A bit uncomfortable.

Maybe let it to user to specify the version of html? For convenience, let default variant be "html4" but user should can to simply put "html5" somewhere in YAML-block to have html5 file in output.


> xfun::session_info('rmarkdown')
R version 3.6.2 (2019-12-12)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Gentoo/Linux

Locale:
  LC_CTYPE=ru_RU.utf8          LC_NUMERIC=C                 LC_TIME=ru_RU.utf8           LC_COLLATE=C                
  LC_MONETARY=ru_RU.utf8       LC_MESSAGES=ru_RU.utf8       LC_PAPER=ru_RU.utf8          LC_NAME=ru_RU.utf8          
  LC_ADDRESS=ru_RU.utf8        LC_TELEPHONE=ru_RU.utf8      LC_MEASUREMENT=ru_RU.utf8    LC_IDENTIFICATION=ru_RU.utf8

Package version:
  Rcpp_1.0.3      base64enc_0.1.3 digest_0.6.25   evaluate_0.14   glue_1.3.1      grDevices_3.6.2 graphics_3.6.2 
  highr_0.8       htmltools_0.4.0 jsonlite_1.6.1  knitr_1.28      magrittr_1.5    markdown_1.1    methods_3.6.2  
  mime_0.9        rlang_0.4.4     rmarkdown_2.1   stats_3.6.2     stringi_1.4.6   stringr_1.4.0   tinytex_0.19   
  tools_3.6.2     utils_3.6.2     xfun_0.12       yaml_2.2.1     

Pandoc version: 2.7.3

By filing an issue to this repo, I promise that

  • [x] I have fully read the issue guide at https://yihui.org/issue/.
  • [x] I have provided the necessary information about my issue.
    • If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
    • If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included xfun::session_info('rmarkdown'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: remotes::install_github('rstudio/rmarkdown').
    • If I have posted the same issue elsewhere, I have also mentioned it in this issue.
  • [x] I have learned the Github Markdown syntax, and formatted my issue correctly.

I understand that my issue may be closed if I don't fulfill my promises.

UlvHare avatar Feb 23 '20 12:02 UlvHare