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 button for code blocks #1748

Merged
merged 6 commits into from
Jan 14, 2022
Merged

Copy button for code blocks #1748

merged 6 commits into from
Jan 14, 2022

Conversation

pfitzseb
Copy link
Member

image

Fixes #1055.

@fredrikekre
Copy link
Member

I think it looks better with a copy icon like in #1454 instead of Copy

@pfitzseb
Copy link
Member Author

Fair.

image
image

@fredrikekre
Copy link
Member

Could the button be added only if javascript is enabled (i.e. at "runtime")? I did that here https://github.com/fredrikekre/fredrikekre.se/blob/master/_libs/clipboard.js for example. The way I did it there I don't need to do any unescaping, or include the code twice (once printed without colors as you do here IIUC). But maybe thats just because I used https://clipboardjs.com/ which handles that for me? Any reason not to use that?

@pfitzseb
Copy link
Member Author

Sure, we can do that as well.

@fredrikekre
Copy link
Member

Nice, add a changelog entry?

@fredrikekre
Copy link
Member

Something buggy with the icons using the dark theme? I see this:
Screenshot 2022-01-13 at 22 32 54
for example (firefox, macos).

@fredrikekre
Copy link
Member

Ah, looks like a CSS problem. In the dark theme font-family is overridden so it is missing font-family: "Font Awesome 5 Free";

@pfitzseb
Copy link
Member Author

image

@fredrikekre fredrikekre merged commit 17ef40a into master Jan 14, 2022
@fredrikekre fredrikekre deleted the sp/code-copy-button branch January 14, 2022 20:34
@mortenpi mortenpi added Type: Enhancement Format: HTML Related to the default HTML output labels Mar 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Format: HTML Related to the default HTML output Type: Enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: copy to clipboard
3 participants