I'm trying to link to another section in a different README.md in a different directory of my project and I'm not having much success with it. I've tried:
and it links to the README.md file, but not to the section within the file.
Does anyone know if this can be done?
Any help would be greatly appreciated!
Most of the times when you hover with your cursor over the title you see a link symbol appearing next to it. Try clicking that. It then copies the link to your clipboard. If you use that link it should work.
If that doesn't work either it may be your browser who is playing games with you.
Seems to work for me in this test repo I have. You have the link target has to match the "dasherized" version of the heading. Did you do that?
Let us know if you have any other questions.
I'm having the same issue as the original poster. It seems to me that your solution is leveraging full http path, whereas what the original author and I are trying to do is leverage the markdown linking.
So assume you have two files F1.md and F2.md in the same folder.
Assume further that F2.md has a section called Introduction, and you'd like to link to Introduction in F1.md.
If I write in F1.md the following: "As described in [Introduction](F2.md#Introduction)..." then Ctrl+clicking on this link opens F2.md, but it does not focus on the section Introduction.
Any idea how to make that work?
If you look at the source for the Markdown file I linked to, you'll notice that I didn't give the full HTTP path. I only gave just enough to fully specify the file that I wanted (since it is in another directory) and the section within the file:
Can you show me an example in a public repository that isn't working as expected?
Thanks, lee-dohm, for your courteous reply. I had looked at the link in your comment above and assumed that was the link you were talking about. I suppose Github simply turned your relative link into a full url link.
As to your question, the problem I'm facing is occurring inside a markdown editor called Typora. I was not sure if this was a bug attributable to the editor or if it was a limitation in the markdown specs. Based on your code, this must be a bug of the editor itself.
If you're asking about functionality that isn't on GitHub, then it wouldn't necessarily work the same way. Some of this link-handling behavior is specific to GitHub.
You should be able to use relative links though. So if you're trying to link to another document in the same folder, then you should be able to use:
[link to section](./F2.md#section)
I hope that helps!