downlit
downlit copied to clipboard
Autolinking Quarto html remove the "copy-code" button
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 (https://github.com/r-lib/downlit/blob/4011b2f470750dc51a8001eaa739dbcff257ffb1/R/downlit-html.R#L54).
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)
This is taken care of in #155
Awesome, thanks!
@edgararuiz For information, the PR I made turned out to be wrong.