Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linking using relative path on Github README.md

Tags:

I am trying to create links in my README.md that link to example code using a relative path, as opposed to the absolute path I am using now. For example, in the markdown file, if I use this:

[someLabel](https://github.com/username/repoName/somePathTo/myExampleCode)

It works no problem. But I would like to link it up using something like this:

[someLabel](username/repoName/somePathTo/myExampleCode)

This does not link up, as it gives me the ol' 404 not found error. Is there a way to link my examples on Github to my README using a relative path?

like image 579
Houdini Avatar asked Aug 08 '12 15:08

Houdini


People also ask

How do I add links to my readme MD?

External Links To link inline, type the text you want to link within brackets, "[x]", followed directly by the link URL parentheses, "(y)". Reference-style linking allows you to give a link a number or "name" and refer to it multiple times.

How do you add a link to a readme in GitHub?

Links. You can create an inline link by wrapping link text in brackets [ ] , and then wrapping the URL in parentheses ( ) . You can also use the keyboard shortcut Command + K to create a link.

How do I link to a file in GitHub?

Linking to code On GitHub.com, navigate to the main page of the repository. Locate the code you'd like to link to: To link to code from a file, navigate to the file. To link to code from a pull request, navigate to the pull request and click Files changed.


1 Answers

They seem to have changed this since Aug 8 '12, so now all I had to do to reference my pdf file inside the Documentation folder (which is in my project's root) is this:

[file.pdf](Documentation/file.pdf)

So, no need to add blog/master part anymore. Hope it helps new people browsing this question.

like image 162
Nikola Avatar answered Dec 04 '22 22:12

Nikola