xaringan icon indicating copy to clipboard operation
xaringan copied to clipboard

Multi line string highlighting is not correct

Open cderv opened this issue 2 years ago • 4 comments

From https://community.rstudio.com/t/xaringan-highlight-multi-line-strings-in-a-code-chunk/141311

--- 
title: "A Minimal Book Example"
output: xaringan::moon_reader
---

# test

```{r, eval = FALSE}
df <- dbGetQuery(con, "SELECT film_id, title, description FROM 
                 film WHERE release_year = 2006")
head(df, 3)
```

I think this is an issue with highlight.js and remark.js.

Not sure if we can tweak something on our side.

BTW This is working correctly for html_document.

cderv avatar Jul 04 '22 09:07 cderv

remark.js bundled a version of highlight.js in it, so this is probably not easy to fix. I'm not sure what will happen if we load another version of highlight.js in the document (i.e., whether remark.js will use that version).

yihui avatar Jul 05 '22 14:07 yihui

So maybe this is an issue to raise in remark.js for their embeded highlight.js version ?

cderv avatar Jul 06 '22 10:07 cderv

Yes, I think so. I'm not sure if the latest version of remark.js (currently 0.15.0) has fixed it.

yihui avatar Jul 06 '22 13:07 yihui

There are several changes to highlighting in 0.15 : https://github.com/gnab/remark/blob/c69c25fa94c45ac8bfa668bee1d878e86517f93a/HISTORY.md#015

But I tested like this

--- 
title: "A Minimal Book Example"
output: 
  xaringan::moon_reader:
    chakra: https://remarkjs.com/downloads/remark-0.15.0.min.js
---

# test

```{r, eval = FALSE}
df <- dbGetQuery(con, "SELECT film_id, title, description FROM 
                 film WHERE release_year = 2006")
head(df, 3)
```

but still get the same results.

cderv avatar Jul 06 '22 14:07 cderv