-
Notifications
You must be signed in to change notification settings - Fork 100
Open
Description
It would be helpful for code blocks to be copyable using a button. Stripe does this nicely with a clipboard button in the corner.
In js, this is not very difficult to achieve, it's something like:
// Get text without syntax-highlighting tags
const plainText = codeblock.innerText;
navigator.clipboard.writeText(plainText).then(() => {
// Do something appropriate to confirm stuff has been copied
console.log('Code copied!');
}).catch(err => {
console.error('Failed to copy:', err);
});
PS: Sorry for the many opened issues, I just thought I'd a braindump of what I think would be nice after working on some documentation for a while :)
Metadata
Metadata
Assignees
Labels
No labels