How to add a relative link to a file in a submodule in github markdown?

Viewed 1867

I'm using markdown for the README file in my repositories.

Relative links work well for files in the same repo.

But I want to link a file in a submodule (so that the same version as the submodule is displayed).

The usecase is the following: I have a submodule in external/fancy-lib. In the README.md of my repository I want to add "please refer to fancy-lib's [README](external/fancy-lib/README.md) for info about the required packages", but it generates a non-existent link.

Adding a link to fancy-lib's README from fancy-lib's repository would point to HEAD which is not always the same version included in my repository. On the other hand, manually updating the link each time the submodule is updated to a new version (git pull) is a burden of maintenance.

Any workaround?

1 Answers

I do not think relative links are going to work. One can always use the full URL though, which is something like

![](https://raw.githubusercontent.com/<account>/<name of submodule repo>/README.md)

or

https://github.com/<account>/<repo>/blob/<hash>/README.md
Related