-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add code copy buttons using 'markdown-it-copy' plugin #203
base: main
Are you sure you want to change the base?
Conversation
As a side note... The plugin has a "success" popout thing after you click the button. Out-of-the-box it shows up for 2 seconds then disappears. The javascript for that is contained in the plugin but with some css you can set it to fade out when you leave the button. At first I thought option 1, where it lingered around, looked kinda weird, but after using it for a few days i noticed your eyes tend to move off to where you are pasting to really see it. In any case, I also tryed option 2 and at first I liked it but in fact having it fade away instantly if you are moving fast might be weirder. But I don't know, let me know what you think is a more sane default. Option 1 is simpler. Option 2 is a couple extra lines of css (lines 224-226 added in markdown.css). Option 2 is currently set but you can set opacity on line 204 back to Of course either could be achieved in custom css. |
Hello! How is it going on this? When testing with
Do you know what that |
Yeah I discovered this the day after posting, happens to me too. I don't know why it is looking for code.js, must be the npm |
6c56e4f
to
733d51a
Compare
d0c8356
to
e9ddc3d
Compare
e9ddc3d
to
750ae8c
Compare
Issue #202
Hi all,
I'm working on adding "copy code" buttons like seen on GitHub, Microsoft docs, stack overflow etc.
Feedback so far:-
<pre>
block is hovered overDefault visibility can be toggled back on in custom css.
One thing I'm still struggling with is the alignment issue. @jannis-baum I tryed your suggestion, but turns out I had already set the
<pre>
element with the scrolloverflow
to relative and then set the button toabsolute
with atop
,right
offset. However, while that sets the starting position correctly, it then scrolls along with the overflow box (see blow for example).If I wrap the
<pre>
in a containing<div>
and set the the button relative to the<div>
then it works as expected, but the<pre>
blocks are created by the markdown plugin and I don't know how or if that is the right approach.A comparison of the change
So looking for feedback / ideas on that.
I've pushed the PR branch here in-case anyone wanted to try it out.