Replies: 1 comment
-
|
For anyone that stumbles upon this, the best solution I've found is to use a text fragment link to the raw file: unfortunately the same text fragment technique doesn't work on the rich github UI, because github clears the hash |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
When linking to GitHub source code, either from (a) in-repo MarkDown via relative paths or (b) by using URLs, currently a line number can be used to indicate a particular location in a source file. For example
myDir/myFile.cs#L23.This is brittle because in many languages such as C# code moves around a lot and the line number must be continually tracked and updated.
Also you normally really want to link to a code definition rather than a line number. (And, ideally in the future, have tooling in your IDE etc that can detect broken links because a code symbol has been removed/renamed.)
For these reasons, I would like to request support for linking to code symbols in a file such that GitHub looks at the file to determine the location of the symbol and lands there. Use of the URL fragment "#Symbol" as given in the discussion title could be a way to do this.
Beta Was this translation helpful? Give feedback.
All reactions