ptpb / pb

pb is a formerly-lightweight pastebin and url shortener
Other
549 stars 52 forks source link

Highlight multiple lines #215

Closed baco closed 6 years ago

baco commented 6 years ago

Add the ability to highlight more than just one line (#L-6), for instance multiple lines, #L-6,8,10 or blocks ranges #L-6:L-9.

buhman commented 6 years ago

I suspect this is harder to do with pure CSS selectors; I'll look at what github and similar do.

buhman commented 6 years ago

When you select one or multiple lines on github, some event listeners add/remove a highlight class from the DOM. This means that it likely does at least:


pb uses the css :target selector instead, which depends on the current url fragment. It is not possible for a url fragment to directly represent "ranges of anchors".

I don't think this is something that can/should be fixed "in place" on top of the current code highlighter.

buhman commented 6 years ago

background: I view pb itself as an API service; human-oriented presentation components like code highlighting are merely the result of poor/hasted decision making in a well-intended attempt to improve pb usability/feature-parity.


Similar to how /f is actually a SPA, this should be a new pb-code-highlight SPA. I suggest such a thing would be a nice beginner elm-lang project.

Provided someone (including me) is willing to write such a SPA, I'm also explicitly willing to update pb and/or the ptpb.pw deployment to provide convenience shortcuts to said SPA, or even well-reasoned backwards-compatible API changes if it would facilitate this more cleanly.

That said, I'm closing the add non-pure-selector-based line highlighting to the current pb syntax highlighting component idea, as written, as wontfix.