-
Notifications
You must be signed in to change notification settings - Fork 41
Description
Hello,
I asked for a feature request in astrojs regarding the Copy Button they use on their code blocks. cf withastro/starlight#2993
I was told that this Copy Button feature comes from expressive code so I open this issue to discuss the feasability of this request.
currently on astrojs/starlight, when a diff code block is copied in the clipboard, it contains all the code that is shown on screen, but without the +/- of the diffed lines. so in the clipboard we get non working code.
I would suggest that when used in diff mode
- the lines starting with + are kept, but without the + as it works today
- the lines starting with - are removed and not added to the clipboard
there is an example I posted in the starlight repo. let me copy it here for easier reference :
when
is copied to the clipboard, i get
function ceciEstDuJavaScript() {
// Ce bloc entier utilise la coloration syntaxique JavaScript,
// et nous pouvons toujours y ajouter des marqueurs de différence !
console.log('Ancien code à supprimer')
console.log('Nouveau code brillant !')
}while I would expect
function ceciEstDuJavaScript() {
// Ce bloc entier utilise la coloration syntaxique JavaScript,
// et nous pouvons toujours y ajouter des marqueurs de différence !
console.log('Nouveau code brillant !')
}Do you think this would be an interesting feature to add ?
can you tell me where the removal of the +/- is done in the code ; I could look at it and maybe propose a PR if it is not too complicated (this would be my first expressive-code PR)
