Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy buttons for code blocks #17

Closed
mbostock opened this issue Oct 18, 2023 · 2 comments · Fixed by #177
Closed

Copy buttons for code blocks #17

mbostock opened this issue Oct 18, 2023 · 2 comments · Fixed by #177
Assignees
Labels
design Designs needed for a polished UI enhancement New feature or request good first issue Good for newcomers

Comments

@mbostock
Copy link
Member

It’d be nice if code blocks had convenient copy buttons, like they do on GitHub and VitePress.

@mbostock mbostock added enhancement New feature or request good first issue Good for newcomers labels Oct 18, 2023
@trebor
Copy link
Contributor

trebor commented Nov 7, 2023

i'm having a look at this. it looks like we are using markdown-it for markdown. so i am exploring these plugins:

if they aren't fit for purpose, perhaps i can use them as a template for our own plugin.

@trebor trebor self-assigned this Nov 7, 2023
@trebor
Copy link
Contributor

trebor commented Nov 7, 2023

it's looking like markdown-it-copy might be the correct thing. @byrideout i realized i was trying to work out how this should look and maybe you have a thought on this. currently the cli renders 2 letter type ids into the upper right corner of the box, "js" for javascript:

Image

"md" for markdown.

Image

etc.

do you thoughts on a clean way to incorporate a copy button into this? i also have "success" and "fail" messages which can be rendered based on the copy operation.

@mbostock mbostock added this to the General availability milestone Nov 13, 2023
@trebor trebor added the design Designs needed for a polished UI label Nov 14, 2023
@Fil Fil mentioned this issue Nov 15, 2023
@Fil Fil closed this as completed in #177 Nov 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design Designs needed for a polished UI enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants