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

前端 未结 14 1679
眼角桃花
眼角桃花 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:28

    Using kramdown, it seems like this works well:

    [I want this to link to foo](#foo)
    ....
    ....
    {: id="foo"}
    ### Foo are you?
    

    I see it's been mentioned that

    [foo][#foo]
    ....
    #Foo
    

    works efficiently, but the former might be a good alternative for elements besides headers or else headers with multiple words.

提交回复
热议问题