3

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?

4

I took your original hash link, changed raw in URL to blob, added #L40, and got this. Is this the thing you wanted?

  • Exactly the solution I was going to suggest. – Sophie Alpert Jul 11 '10 at 16:43
  • Yes, exactly what I wanted. Thanks! :) (just wish they would also show a yellow fadeout on the line selected...) – hsribei Jul 12 '10 at 12:07
0

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.

  • 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. – hsribei Jul 11 '10 at 14:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.