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

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

    Github automatically parses anchor tags out of your headers. So you can do the following:

    [Custom foo description](#foo)
    
    # Foo
    

    In the above case, the Foo header has generated an anchor tag with the name foo

    Note: just one # for all heading sizes, no space between # and anchor name, anchor tag names must be lowercase, and delimited by dashes if multi-word.

    [click on this link](#my-multi-word-header)
    
    ### My Multi Word Header
    

    Update

    Works out of the box with pandoc too.

提交回复
热议问题