How do I stop code cells with line highlighting from copying multiple times? #13352
-
DescriptionWhen I use code highlighting in code cells for revealjs presentations, the copied code is duplicated as many times as I have stepped through the code with line highlighting. How do I stop code cells with line highlighting from copying multiple times? Here's an illustration of when the duplicate code copy happens as a function of code line highlighting: ---
title: "Duplicate Code Copy"
format:
revealjs:
code-copy: true # Show copy button on code blocks
self-contained: true # Render to a single HTML file
execute:
eval: false
echo: true
jupyter: python3
---
Duplicate code copy
```{python}
#| code-line-numbers: "|1-2|4-6|8-10"
import numpy as np
import polars as pl
# Set randomization seed and n
rng = np.random.default_rng(42)
n = 10_000_000
# Discrete uniform distribution
disc_unif = np.random.randint(1, 7, size=n)
draws = pl.DataFrame(disc_unif, schema=['disc_unif'])
```
And when it does not duplicate code copy due to the absence of code line highlighting:
```{python}
import numpy as np
import polars as pl
# Set randomization seed and n
rng = np.random.default_rng(42)
n = 10_000_000
# Discrete uniform distribution
disc_unif = np.random.randint(1, 7, size=n)
draws = pl.DataFrame(disc_unif, schema=['disc_unif'])
``` This is Quarto version 1.8.20 on macOS 15.6.1. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Could you properly format your post using code blocks for code and terminal outputs? Thanks.
I cannot reproduce your issue on the latest release candidate. Since you are using pre-releases, before reporting issues, please be sure to always use the latest. |
Beta Was this translation helpful? Give feedback.
Could you properly format your post using code blocks for code and terminal outputs? Thanks.
If your code contains code blocks, you need to enclose it using more backticks, i.e., usually four
````
.See https://quarto.org/bug-reports.html#formatting-make-githubs-markdown-work-for-us.
self-contained
is a three-years old deprecated option. The correct current option isembed-resources
.I cannot reproduce your issue on the latest release candidate.
Since you are using pre-releases, before reporting issues, please be sure to always use the latest.