Make each HTML element for highlighting only span one line
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 13k
- Forks
- 1.4k
- Avg merge
- 15h 36m
- Merged PRs (30d)
- 3
Description
Motivation
I want to show an excerpt of the highlighted code. After processing and highlighting the complete code using Prism, I want to extract some lines from innerHTML.
Description
It seems like that works mostly, the one exception I currently found was block comments, where the whole block comment is wrapped by a span (in my case, its Python code, so the class is token triple-quoted-string string).
Alternatives
Maybe add an option to Prism.highlightElement where one can configure what lines to return?
Contributor guide
No contributing guide indexed for this repository
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 by tracing Prism.highlightElement and how highlighted Python block comments become spans in innerHTML, especially the token triple-quoted-string string class. Determine how line boundaries should be represented without breaking highlighting, and define completion as each highlighting span covering only one line while preserving the highlighted output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, python
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100