I have a post containing code like
{% highlight ruby linenos %}
Line 1
Line 2
{% endhighlight %}
which is displayed as
1 Line 1
2 Line 2
Unfortunately, if someone copies the code to the clipboard now, it contains the line numbers. Potentially, this is an issue of the generated HTML and not of Jekyll itself, but there might be a simple solution I'm not aware of:
Is there a way to configure Jekyll so that the line numbers like in the example above won't get copied to the clipboard?
As far as I'm aware there's nothing within the templating language that will disable copying of linenos, but adding some simple css like this should prevent them from being selected:
.highlight .lineno {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments