Generate table of contents in your markdown files.
Install with your favourite plugin manager.
With vim-plug
Plug 'drinkataco/vim-md-toc'-
:TocGenerate Table of Contents
Arguments
:Toc 5 ^Contents$- The first argument is used to indicate the maximum depth of the contents children. By default, the value
g:mdtoc_max_levelis used. - The second argument is used to denote patterns of headers to ignore, and their children will also be ignored. A default pattern can be set with
g:mdtoc_ignore_regex.
- The first argument is used to indicate the maximum depth of the contents children. By default, the value
-
:TocNumberedGenerate Table of Contents, Numbered
See
:Tocfor list of arguments -
:TocDeleteDelete Table of Contents, if contents are fenced (see
g:mdtoc_fences) -
:TocUpdateUpdate Table of Contents, if contents are fenced (see
g:mdtoc_fences). Can be automated on all markdown files by settingg:mdtoc_autoupdateto1.
-
g:mdtoc_autoupdateDefault:
0Enable to allow table of contents to be auto updated on save. Requires
g:mdtoc_fencesto be enabled. -
g:mdtoc_fencesDefault:
1Whether to add fences to the generated table for contents (comments that indicate the ToC has been generated by this plugin). Fences are used to discover where the table of contents are for updating and deleting with the
:TocUpdateand:TocDeletecommands. -
g:mdtoc_fence_styleDefault:
xmlBy default, as expected by most markdown parsers, fences are added in the style of xml/html comments;
<!-- vim-md-toc -->. Setting this value tojsallows the fences to be represented like/* vim-md-toc */. -
g:mdtoc_ignore_regexNo Default
Add common regex patterns for headers (and their children) to be ignored. For example,
^Contents$ -
g:mdtoc_max_levelDefault:
0(unlimited)Set the default max child level of the table of contents.
This plugin was developed out of perservim/vim-markdown - based off of the Table of Contents functionality, and includes a bunch of new features and bug fixes.
- Add command context
- Add to nearest header
- use max_level in inserted context
- support multiple table of contents for update, delete
