Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autolinking Quarto html remove the "copy-code" button #156

Open
edgararuiz opened this issue Aug 5, 2022 · 3 comments · May be fixed by #160
Open

Autolinking Quarto html remove the "copy-code" button #156

edgararuiz opened this issue Aug 5, 2022 · 3 comments · May be fixed by #160
Labels
bug an unexpected problem or unintended behavior

Comments

@edgararuiz
Copy link

edgararuiz commented Aug 5, 2022

The copy-code button is removed when running downlit on html pages created by Quarto. This happens because downlit seems to replace any class of the DIV, instead of appending to it (

pre_class = "downlit sourceCode r",
).

Here is a reprex. The "test.html" file will have a copy-code button, but "downlit-test.html" will not:

qmd_lines <- c(
  "---", "title: test", "---", "", "```{r}", "mtcars", "```"
)
writeLines(qmd_lines, "test.qmd")
quarto::quarto_render("test.qmd")
#> �[31m
#> 
#> processing file: test.qmd
#> �[39m  |                                                                              |                                                                      |   0%  |                                                                              |.......................                                               |  33%
#>   ordinary text without R code
#> 
#>   |                                                                              |...............................................                       |  67%
#> label: unnamed-chunk-1
#>   |                                                                              |......................................................................| 100%
#>   ordinary text without R code
#> 
#> 
#> �[31moutput file: test.knit.md
#> 
#> �[39m�[1mpandoc �[22m
#>   to: html
#>   output-file: test.html
#>   standalone: true
#>   section-divs: true
#>   html-math-method: mathjax
#>   wrap: none
#>   default-image-extension: png
#>   
#> �[1mmetadata�[22m
#>   document-css: false
#>   link-citations: true
#>   date-format: long
#>   lang: en
#>   title: test
#>   
#> Output created: test.html

downlit::downlit_html_path("test.html", "downlit-test.html")

Created on 2022-08-05 by the reprex package (v2.0.1)

@etiennebacher
Copy link

This is taken care of in #155

@edgararuiz
Copy link
Author

Awesome, thanks!

@etiennebacher
Copy link

@edgararuiz For information, the PR I made turned out to be wrong.

@etiennebacher etiennebacher linked a pull request Sep 20, 2022 that will close this issue
@hadley hadley added the bug an unexpected problem or unintended behavior label Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
3 participants