Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Highlight the line number that is anchored #29

Raynes opened this Issue · 2 comments

2 participants


You can anchor to line numbers if you want to point someone at a specific part of your code. However, if your paste is so short that the whole thing fits in the window or the line number you're anchored to is near the top, there will be no visible cues as to which line number you're pointed to. You'd have to look at the URL and then look for that line. We don't have to make things complicated and highlight the whole line (I'm not sure if that's even feasible with Pygments). As a matter of fact, I don't want to. I think it'd be really cool to highlight the actual line number itself. That should be easy to do with a little Javascript. We can make it some bright color that sticks out.


It is doable but kinda nasty due to the generated markup, basically there are a bazillion spans covering each different highlighted character in the code being viewed, with interleaved anchors, you'd have to parse to find the anchor you want then crawl the elements between that anchor and the next line's anchor and modify the span to include some kind of .line-highlight class (or just modify the style attr directly). This may actually be easier to do on the server side and change the anchors to api links...


I'm actually already working on this. This is easier than you think.

@Raynes Raynes closed this in 77c6be8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.