Skip to content

Commit 1cb5aae

Browse files
committed
Update README doc
1 parent c50b82c commit 1cb5aae

File tree

3 files changed

+71
-14
lines changed

3 files changed

+71
-14
lines changed

README.md

Lines changed: 71 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,35 @@
11
# vim-markdown-toc
22

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.
44

55
[中文版使用指南][7]
66

77
## Table of Contents
88

9-
* [Usage](#usage)
9+
<!-- vim-markdown-toc GFM -->
10+
* [Features](#features)
1011
* [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)
1116
* [Screenshots](#screenshots)
1217
* [References](#references)
1318

14-
## Usage
19+
<!-- vim-markdown-toc -->
1520

16-
There are *GFM* and *Redcarpet* two styles TOC links, see [here][1] to view their difference.
21+
## Features
1722

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.
1924

20-
1. `:GenTocGFM`
25+
Supported Markdown parsers:
2126

22-
Generate table of contents in [GFM][2] link style.
27+
- [x] GFM (GitHub Flavored Markdown)
28+
- [x] Redcarpet
2329

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.
2931

30-
Suit **Jekyll or anywhere else use Redcarpet as it's markdown parser**.
32+
* Auto update existing table of contents on save.
3133

3234
## Installation
3335

@@ -43,6 +45,60 @@ Suggest to manage your vim plugins via [Vundle][4] so you can install it simply
4345
4446
3. `:PluginInstall`
4547
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+
46102
## Screenshots
47103

48104
* [online demo in English][5]
@@ -62,5 +118,6 @@ Suggest to manage your vim plugins via [Vundle][4] so you can install it simply
62118
[3]: https://github.com/vmg/redcarpet
63119
[4]: http://github.com/VundleVim/Vundle.Vim
64120
[5]: https://github.com/mzlogin/chinese-copywriting-guidelines/blob/Simplified/README.en.md
65-
[6]: http://mazhuang.org/wiki/chinese-copywriting-guidelines/
121+
[6]: https://github.com/mzlogin/awesome-adb
66122
[7]: http://mazhuang.org/2015/12/19/vim-markdown-toc/
123+
[8]: https://github.com/junegunn/vim-plug

screenshots/chinese.gif

-221 KB
Loading

screenshots/english.gif

-61.3 KB
Loading

0 commit comments

Comments
 (0)