Open EmilHvitfeldt opened 1 year ago
Thanks for the report! Do you have any particular configuration/options enabled in case it's some kind of "conflict"?
Could you share a small self-contained "working" (reproducible) example to work with, i.e., a complete Quarto document or a Git repository? Thanks.
You can share a Quarto document using the following syntax, i.e., using more backticks than you have in your document (usually four ````
).
````qmd
---
title: "Reproducible Quarto Document"
format: html
---
This is a reproducible Quarto document using `format: html`.
It is written in Markdown and contains embedded R code.
When you run the code, it will produce a plot.
```{r}
plot(cars)
The end.
I edited the post. The backticks were missing.
I can reproduce. I believe this is related to revealJS or maybe our custom CSS.
This get better with
format:
revealjs:
code-line-numbers: true
So possibly related to this CSS rule.
position: relative
herepre.numberSource code > span {
position: relative;
left: -4em;
counter-increment: source-line;
}
I wonder if this is not something browser and CSS related. I don't know if we can do something about it.
However, copy paste works ok with the selection it seems. No missed or added character.
I dug into it a little.
The lines are styled with:
.reveal pre.numberSource code > span {
left: -2.1em;
}
and the line numbers are styled with this: (only showing relevant lines)
pre.numberSource code > span > a:first-child::before {
width: 4em;
}
If we change to the following it looks fine on my end.
.reveal pre.numberSource code > span {
left: 0em;
}
pre.numberSource code > span > a:first-child::before {
width: 1.9em;
}
This change also means that the line numbers div fits inside the code div
interesting ! Thanks for find this @EmilHvitfeldt.
FWIW the default styling comes from Pandoc's highlighting directly https://github.com/jgm/skylighting/blob/0c2a119496ece5c40c3c1a6aa7293376bc433b08/skylighting-format-blaze-html/src/Skylighting/Format/HTML.hs#L176-L185
But we can indeed overwrite it in our line-highlight plugin.... 🤔
(could not reproduce with html format)
And by the way, this can reproduce with HTML format, but you need to activate code line number
format:
revealjs: default
html: default
code-line-numbers: true
So it means we need a more generic fix 🤔 A bit more tricky to adjust this width and left position setting without messing something...
Moreover I still don't understand what this space in the selection is really... I can't identify what creates it. 🤷♂️
Moreover I still don't understand what this space in the selection is really... I can't identify what creates it. 🤷♂️
I think it is the "new-line" character. You can select just that thing and copy-paste it.
I think it is the "new-line" character.
Oh ok. But still puzzling that it does not move to the left with other character...
Bug description
When you select code in a code chunk in revealjs slides (could not reproduce with html format) it leaves a gap in the selection.
Steps to reproduce