我经常通过URI中的#L
参数链接到GitHub源代码。
例如:https://github.com/github/learn.github.com/blob/gh-pages/episodes.yaml#L1
但是有没有办法链接到Markdown文件中的行呢?
例如https://github.com/github/learn.github.com/blob/gh-pages/README.md#L1 (不工作!)
我知道我可以链接到“部分”,但是线条要好得多!
例如https://github.com/github/learn.github.com/blob/gh-pages/README.md#learngithubcom
发布于 2022-01-11 11:43:47
当您想要链接到您控制的文件中的某一行时,可以使用<a>
:https://stackoverflow.com/a/6494918/5053865
示例:
<a name="your_link_name">
Some line which you want to link to
</a>
... some wall of text ...
and here you are able to link to [the line](#your_link_name)
GitHub上的示例:https://github.com/evis/markdown-link-to-line (在自述文件中)。
这样,您不能引用具有给定数字的行,但可以引用具有所需内容的行(这正是您经常需要的内容)。
https://stackoverflow.com/questions/14388983
复制相似问题