johnrubansingh / gitiles

Automatically exported from code.google.com/p/gitiles
0 stars 0 forks source link

Feature request: Add html anchors to line numbers in file view #41

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
When posting gitiles file-view URL's into bug reports, it would be very nice to 
be able to link to an html anchor for the exact line I'm interested in.  
Something like:

https://gerrit.googlesource.com/gitiles/+/master/gitiles-war/src/main/webapp/WEB
-INF/web.xml#line20

Ideally, the html might look like this:

<li class="L9"><a name="line20"><a 
href="#line20"><span>...</span></a></a><br></li>

The <a href="#line20"> is just to make it easy to right-click and "Copy link 
address"

Original issue reported on code.google.com by szager@chromium.org on 21 Feb 2014 at 10:12

GoogleCodeExporter commented 9 years ago
I don't want to fork prettify.js, and eventually I want to move to CodeMirror. 
But I think in the meantime it wouldn't be hard to do this by postprocessing 
every <li> within the <pre class="prettyprint">. Not sure what the performance 
impact would be (though considering we may already show a flash of unstyled 
<pre> this may be ok).

Original comment by dborowitz@google.com on 21 Feb 2014 at 10:15