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

前端 未结 14 1690
眼角桃花
眼角桃花 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条回答
  •  Happy的楠姐
    2020-11-29 15:03

    The pandoc manual explains how to link to your headers, using their identifier. I did not check support of this by other parsers, but it was reported that it does not work on github.

    The identifier can be specified manually:

    ## my heading text {#mht}
    
    Some normal text here,
    including a [link to the header](#mht).
    

    or you can use the auto-generated identifier (in this case #my-heading-text). Both are explained in detail in the pandoc manual.

    NOTE: This only works when converting to HTML, LaTex, ConTeXt, Textile or AsciiDoc.

提交回复
热议问题