xaringan icon indicating copy to clipboard operation
xaringan copied to clipboard

[Bug report] Double backticks for inline code breaks new remark-slide command

Open anna-doizy opened this issue 5 years ago • 4 comments

Hi,

Somehow, when double backticks (``) surround inline code (eg to put single ` in it), the --- command is not recognized as new slide instruction anymore. Anyway, I have found a less elegant html workaround. I was thinking that it could be possible to fix, but it overtakes my skills by far. I'm not even sure whether it is a xaringan or a remark issue.

Here is a reproducible chunk:

---
title: "Backticks issue"
output: xaringan::moon_reader
---
This will break the next slide(s): `` `5` <- "ananas" ``.

---
It seems to be difficult to use `knitr::inline_expr()` in this case.

---
This will work fine: <code>\`5\` <- "ananas"</code>.

---
Something smart here.

Thank you for reading me! Cheers, Anna

PS: such a great package - again, thanks!

Session info
xfun::session_info('xaringan')
#> R version 4.0.2 (2020-06-22)
#> Platform: x86_64-w64-mingw32/x64 (64-bit)
#> Running under: Windows 8.1 x64 (build 9600)
#> 
#> Locale:
#>   LC_COLLATE=French_France.1252  LC_CTYPE=French_France.1252   
#>   LC_MONETARY=French_France.1252 LC_NUMERIC=C                  
#>   LC_TIME=French_France.1252    
#> 
#> Package version:
#>   base64enc_0.1.3 BH_1.72.0.3     digest_0.6.25   evaluate_0.14  
#>   glue_1.4.1      graphics_4.0.2  grDevices_4.0.2 highr_0.8      
#>   htmltools_0.5.0 httpuv_1.5.4    jsonlite_1.7.0  knitr_1.29     
#>   later_1.1.0.1   magrittr_1.5    markdown_1.1    methods_4.0.2  
#>   mime_0.9        promises_1.1.1  R6_2.4.1        Rcpp_1.0.5     
#>   rlang_0.4.7     rmarkdown_2.3   servr_0.18      stats_4.0.2    
#>   stringi_1.4.6   stringr_1.4.0   tinytex_0.25    tools_4.0.2    
#>   utils_4.0.2     xaringan_0.16   xfun_0.16       yaml_2.2.1

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('xaringan'). 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('yihui/xaringan').
    • 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.

anna-doizy avatar Jul 30 '20 06:07 anna-doizy

I had nearly this exact same issue. It was driving me nuts. Thanks for the simple workaround. Hadn't thought of that.

hollina avatar Jul 14 '21 01:07 hollina

FWIW I think this is an issue with remark.js parser and double backticks. The Markdown code is correctly written asis by xaringan in the HTML to be processed by remark.js

I don't know if double backticks syntax is currently supported by remark. But they surely seem to break the --- slide delimiter.

Maybe we should open an issue there ? 🤔 Did you already ?

cderv avatar Jul 15 '21 09:07 cderv

Hi @cderv , Thanks for your interest. I didn't, as I have no clue about how to rephrase my initial issue. I don't know enough js to be sure that I'll be understood and to produce a reprex... I would be grateful if you would take the time to do so. However, as we've got the workaround, I don't think that it is an emergency ;-)

Thanks again anyway!

anna-doizy avatar Jul 15 '21 09:07 anna-doizy

As a workaround you can build (sadly there is no direct download) a static version of remark.min.js and set it within your Rmd:

  xaringan::moon_reader:
    chakra: "path/to/remark.min.js"

To build remark.min.js from a commit in January 2021 (randomly selected), you can do the following

git clone https://github.com/gnab/remark.git
cd remark
git reset --hard c69c25fa94c45ac8bfa668bee1d878e86517f93a
git submodule update --init --recursive
npm install
node make

Then copy out/remark.min.js to the desired location. This requires a working node installation on your machine.

pat-s avatar Aug 27 '21 15:08 pat-s