-
- Notifications
You must be signed in to change notification settings - Fork 3.9k
Description
Context
No response
Description
Our documentation contains shell snippets including a command's expected output, like:
One of our users complained about the clipboard button grabbing everything in the block, which is indeed rather annoying for something like shell-session
. Even though the code highlighter correctly recognizes the prompt and the output, that doesn't translate to the behaviour of the clipboard button.
Related links
I ended up here (facelessuser/pymdown-extensions#1802) in my search, but that only really affects text selection. It's still a nice UX improvement, though, and I'll follow the advice given there as well.
Use Cases
I started out trying to influence clipboard.js' behaviour by setting { .shell-session data-clipboard-target="foo !important" data-clipboard-text="go mod init ebpf-test && go mod tidy" }
on the block (ending up on the div), but this only works when I remove the data-clipboard-target
property from the button using my browser's devtools.
Since it can't easily be determined what the correct behaviour is in shell-session
blocks containing multiple lines with commands, I figured it would be nice to be able to manually specify the snippet used by the clipboard button. XYProblem, but it looks like a relatively straightforward change from a distance.
It looks like setupClipboardJS()
already takes data-clipboard-text
into account, but data-clipboard-target
seems to take precedence if both are specified on an element. Not sure why that's the case.
Visuals
No response
Before submitting
- I have read and followed the change request guidelines.
- I have verified that my idea is a change request and not a bug report.
- I have ensured that, to the best of my knowledge, my idea will benefit the entire community.
- I have included relevant links to the documentation, related issues, and discussions to underline the need for my idea.