Prevent line numbers from being copied to clipboard

Thomas Weller

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?

Hayden

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.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

using a wildcard to prevent subtotal line from being filtered and copied excel vba

From Dev

How to prevent Ditto clipboard manager from saving text copied in KeepPassXC?

From Dev

Prevent session from being replicated when JSESSIONID cookie copied

From Dev

Can I prevent object from being copied by std::memcpy?

From Dev

Is there a very effective method to prevent a .jpg file for being copied from a page?

From Dev

Getting a copied email from the clipboard

From Dev

Prevent Excel from clearing copied data for pasting, after certain operations, without Office clipboard

From Dev

How can I prevent javascript from copying a line break to clipboard?

From Dev

Remove trailing new line from 'clipboard' to prevent execution on the terminal?

From Dev

get data from clipboard (copied from Powerpoint)

From Dev

Paste Copied File From Clipboard To File System

From Dev

Prevent war file from being copied to .m2/repository when running mvn clean install

From Dev

How to prevent part of HTML text from being copied when copying adjacent?

From Dev

Prevent C# WPF BitmapSource bytes from being copied before render

From Dev

Prevent QR code from being copied and QR code should be scanable by my mobile app only

From Dev

How to prevent part of HTML text from being copied when copying adjacent?

From Dev

protect images from being copied

From Dev

Prevent alphanumeric strings containing an 'E' from being treated as numbers

From Dev

Bash: save clipboard to a file with line breaks like it was copied

From Dev

Preserve contents of clipboard when a programs from text from copied exits

From Dev

How to prevent binary file folder also being copied to output dir?

From Dev

Avoid the li tag symbol from being copied

From Dev

Protecting raw JSON data from being copied

From Dev

SQL Server DB stop from being copied

From Dev

Android Copy Paste: Special character being copied to clipboard before link text

From Dev

Prevent vim from clearing the clipboard on exit

From Dev

Ruby Project - Prevent a ruby file from directly being called from OS command line

From Dev

Ruby Project - Prevent a ruby file from directly being called from OS command line

From Dev

How can I prevent 16 digit numbers from being logged by nlog?

Related Related

  1. 1

    using a wildcard to prevent subtotal line from being filtered and copied excel vba

  2. 2

    How to prevent Ditto clipboard manager from saving text copied in KeepPassXC?

  3. 3

    Prevent session from being replicated when JSESSIONID cookie copied

  4. 4

    Can I prevent object from being copied by std::memcpy?

  5. 5

    Is there a very effective method to prevent a .jpg file for being copied from a page?

  6. 6

    Getting a copied email from the clipboard

  7. 7

    Prevent Excel from clearing copied data for pasting, after certain operations, without Office clipboard

  8. 8

    How can I prevent javascript from copying a line break to clipboard?

  9. 9

    Remove trailing new line from 'clipboard' to prevent execution on the terminal?

  10. 10

    get data from clipboard (copied from Powerpoint)

  11. 11

    Paste Copied File From Clipboard To File System

  12. 12

    Prevent war file from being copied to .m2/repository when running mvn clean install

  13. 13

    How to prevent part of HTML text from being copied when copying adjacent?

  14. 14

    Prevent C# WPF BitmapSource bytes from being copied before render

  15. 15

    Prevent QR code from being copied and QR code should be scanable by my mobile app only

  16. 16

    How to prevent part of HTML text from being copied when copying adjacent?

  17. 17

    protect images from being copied

  18. 18

    Prevent alphanumeric strings containing an 'E' from being treated as numbers

  19. 19

    Bash: save clipboard to a file with line breaks like it was copied

  20. 20

    Preserve contents of clipboard when a programs from text from copied exits

  21. 21

    How to prevent binary file folder also being copied to output dir?

  22. 22

    Avoid the li tag symbol from being copied

  23. 23

    Protecting raw JSON data from being copied

  24. 24

    SQL Server DB stop from being copied

  25. 25

    Android Copy Paste: Special character being copied to clipboard before link text

  26. 26

    Prevent vim from clearing the clipboard on exit

  27. 27

    Ruby Project - Prevent a ruby file from directly being called from OS command line

  28. 28

    Ruby Project - Prevent a ruby file from directly being called from OS command line

  29. 29

    How can I prevent 16 digit numbers from being logged by nlog?

HotTag

Archive