Introduce option for hljs-meta tags to not be user-selectable.
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.2k
- Forks
- 146
- PR merge metrics
- No merged PRs in 30d
Description
Currently, the >>> and ... in Python REPL snippets are selectable in HTML docs (much as they are here, on Github):
>>> mylist = [
... 0, 1, 2, 3,
... 4, 5, 6, 7
... ]
>>> mylist
[0, 1, 2, 3, 4, 5, 6, 7]
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 to css.mako seems to do the trick:
.hljs-meta {
user-select: none;
pointer-events: none;
}
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 😄.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with css.mako and trace how generated HTML styling is configured for highlight.js output, focusing on the hljs-meta elements used for Python REPL prompts. Determine how an option could control their selection behavior, then verify generated documentation allows code copying without those markers when enabled and preserves existing behavior otherwise.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css, python
- Domain
- documentation
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100