-
Notifications
You must be signed in to change notification settings - Fork 9
Description
Description
The website configuration in quarto.yml sets code copy to true:
Line 111 in 7c45be3
| code-copy: true |
This works for a simple code block using yaml after the 3 backticks. E.g. https://docs.autonity.org/oracle/run-oracle/#atn-and-ntn-data-simulator-plugin.
This does not work for panel tab sets - e.g. https://docs.autonity.org/reference/api/aut/#usage
Quarto docs refs:
- https://quarto.org/docs/output-formats/html-code.html#copy-button
- https://quarto.org/docs/output-formats/html-basics.html#tabsets
To get the copy button, docs say to add to the code block opening 3 backticks for a code block {r eval=FALSE} to the code block for the snippet. Example:
```{r eval=FALSE}
go build -o ./build/bin/plugins/crypto_uniswap ./plugins/crypto_uniswap/crypto_uniswap.go
({r, copy=TRUE, eval=FALSE} works too )
This clearly isn't required for a simple code block but may be a solution for the panel-tabset. However, to use it the .qmd file extension must be used and not the current (legacy) .md extension. Without that change, the quarto build will error and fail if {r eval=FALSE} or {r, copy=TRUE, eval=FALSE} is used on a .md page.
Rationale
Allow code snippets in interface and guide pages to be copied to clipboard by the reader.
Implementation
To fix this and enable code snippets to be copied from code blocks and panel tabsets in website pages, the correct solution from the quarto docs seems:
- page file extension needs changing from
.mdto.qmd. - leading back ticks to the code block should have
{r eval=FALSE}after them
This should be tried to verify if it addresses the copy button issue.
Else, the use of yaml after the opening backticks could be researched to understand if this is a viable solution.