Take the following modified html_paged skeleton:
---
title: "A Multi-page HTML Document"
author: "Yihui Xie and Romain Lesur"
date: "`r Sys.Date()`"
output:
pagedown::html_paged:
toc: true
# change to true for a self-contained document, but it'll be a litte slower for Pandoc to render
self_contained: false
# uncomment this line to produce HTML and PDF in RStudio:
#knit: pagedown::chrome_print
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
# Introduction `r format(Sys.Date(), "%d.%m.%Y")`
This is an example of a multi-page HTML document. See https://pagedown.rbind.io for the full documentation. The rest of this document is random text.
This will knit the title page down until the table of contents. There, the date is correctlys displayed.
The content, the chapters though are not rendered. If I change the date format to %d-%m-%Y it renders fine. Using . does not work as well.
Is there a workaround or is a fix needed? I assume the periods are a problem for the link detection or something but I had no time going through the source code.
R version 4.0.1 (2020-06-06)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)
Matrix products: default
locale:
[1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252
[3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C
[5] LC_TIME=German_Germany.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] raster_3.3-13 scales_1.1.1 lubridate_1.7.9 DBI_1.1.0
[5] rgelsenkirchen_0.1.1 sf_0.9-5 rgdal_1.5-16 sp_1.4-2
[9] gt_0.2.2 tmap_3.2 showtext_0.9 showtextdb_3.0
[13] sysfonts_0.8.1 janitor_2.0.1 forcats_0.5.0 stringr_1.4.0
[17] dplyr_1.0.2 purrr_0.3.4 readr_1.3.1 tidyr_1.1.2
[21] tibble_3.0.3 ggplot2_3.3.2 tidyverse_1.3.0
loaded via a namespace (and not attached):
[1] fs_1.5.0 bit64_4.0.5 RColorBrewer_1.1-2 httr_1.4.2
[5] tools_4.0.1 backports_1.1.9 R6_2.4.1 DT_0.15
[9] KernSmooth_2.23-17 colorspace_1.4-1 withr_2.2.0 tidyselect_1.1.0
[13] leaflet_2.0.3 bit_4.0.4 compiler_4.0.1 leafem_0.1.3
[17] cli_2.0.2 rvest_0.3.6 htmlTable_2.0.1 xml2_1.3.2
[21] checkmate_2.0.0 classInt_0.4-3 odbc_1.2.3 digest_0.6.25
[25] rmarkdown_2.3 base64enc_0.1-3 dichromat_2.0-0 pkgconfig_2.0.3
[29] htmltools_0.5.0 dbplyr_1.4.4 htmlwidgets_1.5.1 rlang_0.4.7
[33] readxl_1.3.1 rstudioapi_0.11 farver_2.0.3 generics_0.0.2
[37] jsonlite_1.7.0 crosstalk_1.1.0.1 magrittr_1.5 Rcpp_1.0.5
[41] munsell_0.5.0 fansi_0.4.1 abind_1.4-5 lifecycle_0.2.0
[45] stringi_1.4.6 leafsync_0.1.0 yaml_2.2.1 snakecase_0.11.0
[49] tmaptools_3.1 grid_4.0.1 blob_1.2.1 parallel_4.0.1
[53] crayon_1.3.4 lattice_0.20-41 haven_2.3.1 stars_0.4-3
[57] hms_0.5.3 knitr_1.29 pillar_1.4.6 codetools_0.2-16
[61] XML_3.99-0.5 reprex_0.3.0 glue_1.4.2 pagedown_0.10.1
[65] evaluate_0.14 pool_0.1.4.3 modelr_0.1.8 png_0.1-7
[69] vctrs_0.3.4 cellranger_1.1.0 gtable_0.3.0 assertthat_0.2.1
[73] xfun_0.16 lwgeom_0.2-5 broom_0.7.0 e1071_1.7-3
[77] later_1.1.0.1 viridisLite_0.3.0 class_7.3-17 units_0.6-7
[81] ellipsis_0.3.1
I think it is an issue similar to https://github.com/rstudio/pagedown/issues/84
Because it is due to the ato generated ID which contains dots because of the date, and the selector throws an error
paged.js:26816 Uncaught (in promise) DOMException: Failed to execute 'querySelector' on 'Element': '#introduction-02.09.2020' is not a valid selector.
So it is a bug in paged.js I think. I'll see if the previous fix can be extended here. In the mean time you can set an id manually.
like that
````md
r format(Sys.Date(), "%d.%m.%Y") {#intro}````
Pagedjs related issue IMO https://gitlab.pagedmedia.org/tools/pagedjs/issues/208
fixed by #202
Most helpful comment
I think it is an issue similar to https://github.com/rstudio/pagedown/issues/84
Because it is due to the ato generated ID which contains dots because of the date, and the selector throws an error
So it is a bug in paged.js I think. I'll see if the previous fix can be extended here. In the mean time you can set an id manually.
like that
````md
Introduction
r format(Sys.Date(), "%d.%m.%Y"){#intro}````