How to link to part of the same document in Markdown?

前端 未结 14 1719
眼角桃花
眼角桃花 2020-11-29 14:50

I am writing a large Markdown document and would like to place a table of contents of sorts at the beginning that will provide links to various locations in the document. Ho

14条回答
  •  心在旅途
    2020-11-29 15:21

    Gitlab uses GitLab Flavored Markdown (GFM)

    Here "all Markdown-rendered headers automatically get IDs"

    One can use mouse to :

    • move mouse over header
    • move mouse over hover selector which becoms visible to the left from header
    • copy and save link using right mouse click

      For example in README.md file I have header:

    ## series expansion formula of the Boettcher function

    which gives a link :

    https://gitlab.com/adammajewski/parameter_external_angle/blob/master/README.md#series-expansion-formula-of-the-boettcher-function

    Prefix can be removed so the link here is simply

    file#header
    

    which here means:

    README.md#series-expansion-formula-of-the-boettcher-function
    

    Now it can be used as :

    [series expansion formula of the Boettcher function](README.md#series-expansion-formula-of-the-boettcher-function)

    One can also do it manually: replace spaces with hyphen sign.

    Live example is here

提交回复
热议问题