GitHub relative link in Markdown file

前端 未结 11 1625
孤独总比滥情好
孤独总比滥情好 2020-11-29 14:40
11条回答
  •  余生分开走
    2020-11-29 14:51

    Update 30th, January 2013, 16 months later:

    GitHub Blog Post Relative links in markup files:

    Starting today, GitHub supports relative links in markup files.
    Now you can link directly between different documentation files, whether you view the documentation on GitHub itself, or locally, using a different markup renderer.

    You want examples of link definitions and how they work? Here's some Markdown for you.
    Instead of an absolute link:

    [a link](https://github.com/user/repo/blob/branch/other_file.md)
    

    …you can use a relative link:

    [a relative link](other_file.md)
    

    and we'll make sure it gets linked to user/repo/blob/branch/other_file.md.

    If you were using a workaround like [a workaround link](repo/blob/master/other_file.md), you'll have to update your documentation to use the new syntax.

    This also means your documentation can now easily stand on its own, without always pointing to GitHub.


    Update December 20th, 2011:

    The GitHub markup issue 84 is currently closed by technoweenie, with the comment:

    We tried adding a tag for this, but it causes problems with other relative links on the site.


    October 12th, 2011:

    If you look at the raw source of the README.md of Markdown itself(!), relative paths don't seem to be supported.
    You will find references like:

    [r2h]: http://github.com/github/markup/tree/master/lib/github/commands/rest2html
    [r2hc]: http://github.com/github/markup/tree/master/lib/github/markups.rb#L13
    

提交回复
热议问题