本文介绍了从Markdown文件相对链接到Repo的根的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我需要一个相对链接到我的回购从降价文件 (我需要它适用于任何分支) 因此它看起来像是在根中为某个文件提供链接的唯一方式: [Root](/ README.md) 或 例如README.md) 与此同时,我可以在不引用文件的情况下引用任何文件夹 [Doc](/ doc) 但是如果我尝试将一个链接放到根文件夹中: [实根](/) [real root](../) 我会有一个链接,例如 https://github.com/UserName/RepoName/ blob / master 不同于 https://github.com/UserName/RepoName/ blob / master / doc 指的是404 不想在根目录中引用README.md(我根本就没有它) 有什么办法可以拥有这样的链接吗? 解决方案经过一番研究,我发现了这样的解决方案: [任何fork的真实相对根](/../../) 它总是指向默认分支。对我来说它是好的,所以这取决于你 PS 用这样的技巧你也可以访问以下功能: [test](/../../ tree / test) - 链接到另一个分支 [doc / readme.md](/../../ edit / master / doc / readme.md) - 在编辑器中打开 $ {code> [doc / readme.md](/../../ delete / master / doc / readme.md) - 请求删除文件 [doc / readme.md](/../。 ./commits/master/doc/readme.md) - history [doc / readme.md]( /../../ blame / master / doc / readme.md) - 责怪模式 [doc /readme.md](/../../ raw / master / doc / readme.md) - 行模式(将重定向) $> [code>] [doc /](/../../ new / master / doc /) - 要求创建新文件 $ b [doc /](/../../ upload / master / doc /) - 请求上传文件 [find](/../../ find / test) - 查找文件 I need to have a relative link to root of my repo from markdown file(I need it working for any forks)So it looks like the only way it's to provide a link to some file in the root:the [Root](/README.md)orthe [Root](../README.md)(if it's located at /doc/README.md for instance)At the same time I can refer to any folder without referring to a filethe [Doc](/doc)But if I try to put a link to the root folder:the [real root](/)the [real root](../)I'll have a link suchhttps://github.com/UserName/RepoName/blob/masterwhich unlike thehttps://github.com/UserName/RepoName/blob/master/docrefers to 404So if I don't want to refer to README.md in the root (I could havn't it at all)Is there any way to have such a link? 解决方案 after some research I've found such solution:[the real relative root of any fork](/../../)it always points to the default branch. For me it's Ok, so it's up to youPSwith such a trick you can also access the following abilities:[test](/../../tree/test) - link to another branch[doc/readme.md](/../../edit/master/doc/readme.md) - open in editor[doc/readme.md](/../../delete/master/doc/readme.md) - ask to delete file[doc/readme.md](/../../commits/master/doc/readme.md) - history[doc/readme.md](/../../blame/master/doc/readme.md) - blame mode[doc/readme.md](/../../raw/master/doc/readme.md) - row mode (will redirect)[doc/](/../../new/master/doc/) - ask to create new file[doc/](/../../upload/master/doc/) - ask to upload file[find](/../../find/test) - find file 这篇关于从Markdown文件相对链接到Repo的根的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!