-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Branch relative links in markdown files #101
Comments
+1 this feature is badly needed |
The only problem with this is that the documentation then does not fulfill the original intent of markdown. Markdown should be usable as plain text and renderable. If you use relative links then it loses it's appeal. |
That problem is already present, I don't think folks can see an absolute URL as an image, any better than they can see a relative URL. |
Yes, but at least they can click on it to see it. |
Right, and I'm saying that if the URL is leading to a fork that might not be there any more, may have been created in order to get the merges into the original, then they can't see it, its broken. |
As it currently stands, .md renders both relative and absolute hyperlinks. Within the same folder, "file.md" and "http://example.com/file.md" both render to the same file, and that's true where ever the .md file is. But because of how github locates sub directories (it inserts the /blob/branch part when displaying a repo via http), relative path between resources differ depending on where the repo hosted. Its entirely a github thing and nothing to do with markup 'intent'. To fix this, github need to change how they render markup to account for it, and they can do this by adding the /blob/fork part to any relative links. |
+1 When adding images to a repo and referencing them in a Markdown file, it's kind of ugly to add a absolute GitHub URL. |
+1 I was banging my head against the wall thinking I was doing something wrong. I just assumed this should be github's expected behaviour. |
+1! |
👍 |
I guess it's time someone merged this PR.... |
+1 |
2 similar comments
+1 |
+1 |
I think someone needs to submit a PR otherwise this ticket will go nowhere. |
👍 |
EDIT: Oh hey, just realized lots of +1's, but no pull requests... |
I looked into the source, but I don't know any Ruby and I don't really get the code. |
So many +1's but no action.... time to unsub from the notifications... |
+1 |
👍 |
1 similar comment
+1 |
+1 |
+1 |
3 similar comments
+1 |
+1 |
+1 |
+1 if there were a way to do this, it would make managing documentation in sync with code so so so much easier, with github as the viewer. |
Seems fixed, you can see that here On Thu, Jan 31, 2013 at 12:02 AM, Tyler Brock notifications@github.comwrote:
Att, |
Holy moly, I thought you were closing as won't fix! You actually deployed it on github! HOORAY. This will make writing good documentation viewable on github SO MUCH EASIER. You are my hero. I haven't played with it yet to confirm it lives up to my fantasy, but i'm very excited. |
@TylerBrock, others : Sorry for not being clear with my comment. It was obvious to me what I meant, but then again I had just blogged / tweeted / published the help article / &c. That comment-and-close could easily be misread by anyone who hadn't seen that stuff yet. |
@ymendel PLEASE good sir, we (the internet) are just happy you did this incredible work and solved the issue. Did you see how happy the bear I posted is? HE'S CRYING FOR GOD SAKES! |
(My next github doc fantasy? The syntax highlighter for ruby could realize when there was embedded markdown/rdoc in top-of-class and top-of-method comments, and render them formatted, heh). |
@ymendel This fix only works if the branch name doesn't have slashes. Link
Compare rendered README.md from https://github.com/Maks3w/zf2/tree/relative-links vs https://github.com/Maks3w/zf2/tree/feature/relative-links |
Woot woot ! Thanks ! |
@ymendel, it would be nice to be able to refer to files in other directories. As an example, suppose I want to have a bunch of screenshots in my README, but don't want to litter the top-level directory with a bunch of image files. |
@timholy thats exactly what the feature four months ago lets you do. Just use relative urls. No? |
It does work if the files are in the same directory, but that doesn't help me with my README example. |
It should definitely be possible to refer to other directories. The links should truly be relative, allowing you to descend into subdirectories as well as go into parent directories (using As far as I can tell, the only part of that StackOverflow post written after this feature release was a copy of the blog post itself. In fact, the original example repo made to show off the failures of relative linking, https://github.com/rynop/testRel, is a good example of how this works very well with links to other directories. If this isn't working for you, do show me a failing case and I can see what's happening. Probably send it to support@github.com, though, so it'll be easier to track. |
Yes, you are right; I must have had a typo or something in my path. Very sorry to have troubled you. |
Link was originally relative, but didn't work when you were viewing from different locations because of the way that GitHub maps repo links in markdown. Issue documented here: github/markup#101
Issue submission link suffered from the same relative link issue. github/markup#101
@timofonic This is fixed around 1.5 years ago |
@avodonosov how to use it? |
@avodonosov maybe I am not getting it completely. There is a repository with a readme file. The readme file has a bunch of badges, which are images and links. I would like those images and the links to external tools, like CI, code coverage etc, to be branch related. How can I cause the branch to be replaced when I switch to master? |
@borismod , I don't know. What you describe is something opposite to what this issue is about. |
@avodonosov 10x. My bad |
@borismod you need to change the branch GET parameter manually in each branch. There is no variable for this that github would substitute. |
@FichteFoll thanks. I've opened a new issue #913 |
A really annoying issue on github is the parsing of links in readme files. Not just for me but for lots of people (see #84 http://stackoverflow.com/questions/7653483/github-relative-link-in-markdown-file)
For readme links to currently work, the absolute link including repo/blob/branch must be hardcoded. That works when viewing on git hub but not for local files. Alternatively, relative links work on local but not on github.
So, why can't github just add the 'repo/blob/branch' part to any relative urls in .md files when parsing? That way, when we want to point an absolute, we include the http://....., and when we want to link to other project files, it works both locally & on github. The whole git philosophy is about distributed control but the current link parsing goes against this
Example
when in a markdown file should be parsed to http://github.com/account/project/blob/branch/subdir/filename
The text was updated successfully, but these errors were encountered: