Automatic TOC in github-flavoured-markdown

后端 未结 17 1751
伪装坚强ぢ
伪装坚强ぢ 2020-12-12 09:24

Is it possible to generate an automatic Table of Contents using Github Flavoured Markdown?

17条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-12 09:39

    Currently it's not possible using markdown syntax (see the ongoing discussion at GitHub), however you can use some external tools such as:

    • Online Table Of Content Generator (raychenon/play-table-of-contents)
    • arthurhammer/github-toc - browser extension that adds a table of contents to GitHub repos

    Alternatively use AsciiDoc instead (e.g. README.adoc), e.g.

    :toc: macro
    :toc-title:
    :toclevels: 99
    # Title
    
    ## A
    
    ### A2
    
    ## B
    
    ### B2
    

    as suggested in this comment. Check the demo here.

提交回复
热议问题