For example, I can link to a specific line of an arbitrary tag and file, like this.
And I can link to an arbitrary sha1 and file, like this, but that's the raw file, so no way to link to a line there.
Is there a way to do sha1, file and line at the same time?
-
Short Answer: No
Long Answer
Line links are achieved by anchor links. After parsing the HTML document, you browser has the knowledge of these anchors and can position the top line of your view frame to requested anchor.
http://github.com/.../initializer.rb#L40
In this example, anchor is named
L40
.On the other hand, raw files are text files and GitHub sends them as is with
Content-type: text/html; charset=utf-8
header. Response content is displayed as is and there is no possibility to direct browser to a predefined offset.obvio171 : Oh, yeah. I didn't mean if I could link to a line in the raw text file itself. The question was rather if there was a way to form a URL with sha1, file, and anchor to the appropriate line.From Berk D. Demir -
I took your original hash link, changed
raw
in URL toblob
, added#L40
, and got this. Is this the thing you wanted?Ben Alpert : Exactly the solution I was going to suggest.obvio171 : Yes, exactly what I wanted. Thanks! :) (just wish they would also show a yellow fadeout on the line selected...)From che
0 comments:
Post a Comment