如何从 github 问题文本中的 markdown 制作一个简短的 link 到特定代码行?

How to make a short link to specific code line from markdown in github issue text?

如何从 github 问题文本中的 markdown 制作一个简短的 link 到特定代码行?

我已经阅读了问题 How to link to specific line number on github,但它是关于将完整的 link 放在 markdown 中。

我的问题是关于一些降价快捷方式,比如 @user#11 issue

文档 Autolinked references and URLs 没有帮助。

没有办法做到这一点。

当您使用@user 指向用户页面或针对当前项目中的特定问题使用#17 时,您创建了一个指向唯一对象的link。当您想向文件代码提供 link 时,也许您想指向 master 中的最新修订版(例如:https://github.com/google/apitools/blob/master/apitools/init.py) or on another branch (ex: https://github.com/google/apitools/blob/csl-patch/apitools/init.py)。据我所知,GitHub flavored markdown 中没有快捷方式可用于 linking 到项目中的特定文件。

正如您已经注意到的,使用这个长格式(完整的 URL),您将能够在 URL 的末尾添加 #LXXX 以指向文件(例如:https://github.com/google/apitools/blob/master/apitools/init.py#L5 or https://github.com/google/apitools/blob/csl-patch/apitools/init.py#L8. But if you really want to avoid long links, you could use GitHub URL Shortener to convert any link (with or without line number) to an equivalent short form: https://git.io/vMD6U