Open sg495 opened 2 years ago
On Firefox 95.0, the hljs-meta
spans are replaced with blank lines when the text is copied (this also happens in the Read the Docs snippet I linked previously, so I think it's an issue with user-select: none
, perhaps specifically inside HTML <code>
tags). On latest Chrome/Edge it works fine.
I tried the following, but it doesn't fix this issue on Firefox:
.hljs-meta {
user-select: none;
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
pointer-events: none;
}
I'll investigate further.
I don't mind using above snippet (the one without vendor prefixes). Some blank lines (BMO#1273836) are still better than nothing. PR welcome.
Is there an issue with making .hljs-meta
tags not user-selectable as you proposed? I think it a legitimate request, and it should find its way into the codebase eventually. :smile:
Currently, the
>>>
and...
in Python REPL snippets are selectable in HTML docs (much as they are here, on Github):This is inconvenient for people wanting to copy-paste the code, e.g. to reproduce the results: they have to manually remove the
>>>
and...
. Lately, I've noticed snippets on Read the Docs where the>>>
and...
are conveniently excluded from the selection. I have looked at the CSS of this snippet, and adding the following tocss.mako
seems to do the trick:I'm not sure about the impact of making
hljs-meta
tags not user-selectable across the board, but to me this seems sufficiently useful a feature to at least deserve a config entry. If this needs further investigation, I'm happy to have a deeper look and make a pull request 😄.