Automatic TOC in github-flavoured-markdown

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

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

17条回答
  •  执笔经年
    2020-12-12 09:45

    Gitdown is a markdown preprocessor for Github.

    Using Gitdown you can:

    • Generate Table of Contents
    • Find dead URLs and Fragment Identifiers
    • Include variables
    • Include files
    • Get file size
    • Generate Badges
    • Print Date
    • Print information about the repository itself

    Gitdown streamlines common tasks associated with maintaining a documentation page for a GitHub repository.

    Using it is straightforward:

    var Gitdown = require('gitdown');
    
    Gitdown
        // Gitdown flavored markdown.
        .read('.gitdown/README.md')
        // GitHub compatible markdown.
        .write('README.md');
    

    You can either have it as a separate script or have it as part of the build script routine (such as Gulp).

提交回复
热议问题