Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 (i.e. https://raw.githubusercontent.com/<account>/<repo>/README.md) would point to HEAD which is not always the same version included in my repository. On the other hand, manually updating the link (i.e. the <hash> in https://github.com/<account>/<repo>/blob/<hash>/README.md) each time the submodule is updated to a new version (git pull) is a burden of maintenance.

Any workaround?

like image 259
fferri Avatar asked Nov 30 '25 02:11

fferri


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
like image 70
aless80 Avatar answered Dec 06 '25 18:12

aless80