Automatic TOC in github-flavoured-markdown

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

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

17条回答
  •  情书的邮戳
    2020-12-12 09:42

    I created two options to generate a toc for github-flavored-markdown:

    DocToc Command Line Tool (source) requires node.js

    Installation:

    npm install doctoc

    Usage:

    npx doctoc . to add table of contents to all markdown files in the current and all sub directories.

    DocToc WebApp

    If you want to try it online first, go to the doctoc site, paste the link of the markdown page and it will generate a table of content that you can insert at the top of your markdown file.

    Github Wikis and Anchors

    As Matthew Flaschen pointed out in the comments below, for its wiki pages GitHub previously didn't generate the anchors that doctoc depends on.

    UPDATE: However, they fixed this issue.

提交回复
热议问题