gistpress icon indicating copy to clipboard operation
gistpress copied to clipboard

Added support for 'line-no-highlight' class

Open mishterk opened this issue 10 years ago • 2 comments

Added the 'line-no-highlight' class to lines that are within an embed containing highlighting, making it possible to specifically style non-highlighted lines. The class doesn't apply to embeds that have no highlighting.

mishterk avatar Aug 10 '14 00:08 mishterk

What you've now got is better. This will add a class to the line, rather than the overall table or div that indicates no highlighting. Is that what you're after?

Why couldn't you assume that all lines were not highighted (which they aren't by default), and then only apply custom highlight styles to highlighted lines?

GaryJones avatar Aug 11 '14 00:08 GaryJones

That is more or less exactly what I was after, although, I agree, feature classes would be just as good a solution, if not better for the extra bit of flexibility they would offer.

Here's why I did it;

On an embed where I have highlighted lines, I'd prefer to fade surrounding lines out and neutralise their colours – this just further separates highlighted lines by reducing distractions. On embeds that don't have any highlighting, the lines should remain untouched.

I originally knocked up a JS solution, but server-side means are better. I couldn't achieve this using adjacent sibling selectors in CSS (~), as I could only select tags that come after the targeted rule. So, if line 2 were highlighted, line 1 wouldn't be picked up by an adjacent selector.

It's really just a means to targeting non-highlighted lines in amongst a gist that has highlighting. I agree, a feature class on the gist would actually be better, but I'll have to wait a few weeks before I look into that, unless someone else makes it happen in the meantime.

mishterk avatar Aug 11 '14 01:08 mishterk