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?

2 Answers 2

4

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

2
  • Exactly the solution I was going to suggest. Commented Jul 11, 2010 at 16:43
  • Yes, exactly what I wanted. Thanks! :) (just wish they would also show a yellow fadeout on the line selected...) Commented Jul 12, 2010 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.

1
  • 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. Commented Jul 11, 2010 at 14:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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