Markdown to create pages and table of contents?

后端 未结 30 2760
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-12 08:49

I started to use markdown to take notes.

I use marked to view my markdown notes and its beautiful.

But as my notes get longer I find it diff

30条回答
  •  余生分开走
    2020-12-12 09:33

    Anchor tags generated by different Markdown parsers are not even.

    If you are working with Markdown parsers GFM (GitHub Flavored Markdown) or Redcarpet, I wrote a Vim plugin to handle table of contents.

    Features

    1. Generate table of contents for Markdown files.

      Supported Markdown parsers:

      • GFM (GitHub Flavored Markdown)
      • Redcarpet
    2. Update existing table of contents.

    3. Auto update existing table of contents on save.

    Screenshots

    vim-markdown-toc

    Usage

    Generate table of contents

    Move the cursor to the line you want to append table of contents, then type a command below suit you. The command will generate headings after the cursor into table of contents.

    1. :GenTocGFM

      Generate table of contents in GFM link style.

      This command is suitable for Markdown files in GitHub repositories, like README.md, and Markdown files for GitBook.

    2. :GenTocRedcarpet

      Generate table of contents in Redcarpet link style.

      This command is suitable for Jekyll or anywhere else use Redcarpet as its Markdown parser.

      You can view here to know differences between GFM and Redcarpet style toc links.

    Update existing table of contents manually

    Generally you don't need to do this, existing table of contents will auto update on save by default. If you want do it manually, just use :UpdateToc command.

    Downloads and documents

    https://github.com/mzlogin/vim-markdown-toc

提交回复
热议问题