You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+71-14Lines changed: 71 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -1,33 +1,35 @@
1
1
# vim-markdown-toc
2
2
3
-
A vim plugin to generate table of contents for a markdown file.
3
+
A vim plugin to generate table of contents for Markdown files.
4
4
5
5
[中文版使用指南][7]
6
6
7
7
## Table of Contents
8
8
9
-
*[Usage](#usage)
9
+
<!-- vim-markdown-toc GFM -->
10
+
*[Features](#features)
10
11
*[Installation](#installation)
12
+
*[Usage](#usage)
13
+
* [Generate table of contents](#generate-table-of-contents)
14
+
* [Update existing table of contents manually](#update-existing-table-of-contents-manually)
15
+
*[Options](#options)
11
16
*[Screenshots](#screenshots)
12
17
*[References](#references)
13
18
14
-
## Usage
19
+
<!-- vim-markdown-toc -->
15
20
16
-
There are *GFM* and *Redcarpet* two styles TOC links, see [here][1] to view their difference.
21
+
## Features
17
22
18
-
Move the cursor to the place you want to insert TOC, then type a command below suit you. The command will generate **headings after the cursor** into TOC.
23
+
* Generate table of contents for Markdown files.
19
24
20
-
1.`:GenTocGFM`
25
+
Supported Markdown parsers:
21
26
22
-
Generate table of contents in [GFM][2] link style.
27
+
-[x] GFM (GitHub Flavored Markdown)
28
+
-[x] Redcarpet
23
29
24
-
Suit markdown files in **GitHub repository**, like `README.md`.
25
-
26
-
2.`:GenTocRedcarpet`
27
-
28
-
Generate table of contents in [Redcarpet][3] link style.
30
+
* Update existing table of contents.
29
31
30
-
Suit **Jekyll or anywhere else use Redcarpet as it's markdown parser**.
32
+
* Auto update existing table of contents on save.
31
33
32
34
## Installation
33
35
@@ -43,6 +45,60 @@ Suggest to manage your vim plugins via [Vundle][4] so you can install it simply
43
45
44
46
3. `:PluginInstall`
45
47
48
+
Installation with [vim-plug][8] is likeness.
49
+
50
+
## Usage
51
+
52
+
### Generate table of contents
53
+
54
+
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.
55
+
56
+
1. `:GenTocGFM`
57
+
58
+
Generate table of contents in [GFM][2] link style.
59
+
60
+
This command is suitable for Markdown files in GitHub repositories, like `README.md`, and Markdown files for GitBook.
61
+
62
+
2. `:GenTocRedcarpet`
63
+
64
+
Generate table of contents in [Redcarpet][3] link style.
65
+
66
+
This command is suitable for Jekyll or anywhere else use Redcarpet as its Markdown parser.
67
+
68
+
You can view [here][1] to know differences between *GFM* and *Redcarpet* style toc links.
69
+
70
+
### Update existing table of contents manually
71
+
72
+
Just use `:UpdateToc` command.
73
+
74
+
## Options
75
+
76
+
1. `g:vmt_auto_update_on_save`
77
+
78
+
default: 1
79
+
80
+
This plugin will update existing table of contents on save automatic.
81
+
82
+
You can close this feature by add the following line to your vimrc file:
83
+
84
+
```viml
85
+
let g:vmt_auto_update_on_save = 0
86
+
```
87
+
88
+
2.`g:vmt_dont_insert_fence`
89
+
90
+
default: 0
91
+
92
+
By default, the `:GenTocXXX` commands will add `<!-- vim-markdown-toc -->` fence to the table of contents, it is designed for feature of auto update table of contents on save, it won't effect what your Markdown file looks like after parse.
93
+
94
+
If you don't like this, you can remove the fence by add the following line to your vimrc file:
95
+
96
+
```viml
97
+
let g:vmt_dont_insert_fence = 1
98
+
```
99
+
100
+
But then you will lose the convenience of auto update tables of contens on save.
101
+
46
102
## Screenshots
47
103
48
104
*[online demo in English][5]
@@ -62,5 +118,6 @@ Suggest to manage your vim plugins via [Vundle][4] so you can install it simply
0 commit comments