Skip to content

Latest commit

 

History

History
102 lines (75 loc) · 3.1 KB

README.md

File metadata and controls

102 lines (75 loc) · 3.1 KB

tagbar markdown extension

Intro

tagbar-markdown is a tagbar extension for markdown.

Screenshot

2017-02-01_1359x723

Install

Prerequisites:

  • ensure PHP is installed, and in your $PATH.
  • bin/mdctags is executable. The install method for vim-plug below does this automatically.

Installing the plugin

Plug 'majutsushi/tagbar'
Plug 'lvht/tagbar-markdown', { 'do': 'chmod +x ./bin/mdctags' }
  • Use dein.vim to lazy load plugin, and check the requirements.
call dein#add('', {'on_cmd' : 'TagbarToggle'})
call dein#add('', {'on_ft' : 'markdown', 'if' : executable('php')})

Configuration

There's one variable that determines what the generated table of contents looks like:

let g:mktagbar_content_format=3
  • Value 3 will generate a table-like list, where line-breaks (--- in markdown) from the document will be added, this allows you to divide the document, and ToC into sections more easily. [DEFAULT]
  • Value 2 will generate the same table-like ToC, omitting the lines
  • Value 1 (or any other value) will generate a simple list containing only the titles.

Examples of each of these formats below

In future, we ought to switch to more intuitively named const variables for each layout option (once vim9 is guaranteed to be available to all).

Generate ToC

Simply executing the command :MDAgenda will insert the ToC, as per configured layout.

Enjoy :)


Examples:

content_format 3

Neatly padded table, with line-breaks.

+==========================================+ | - Intro | | - Screenshot | | - Install | | - Configuration |

- [Generate ToC](#Generate ToC)
- Examples:
- [content_format 3](#content_format 3)
- [content_format 2](#content_format 2)
- [content_format 1](#content_format 1)
+==========================================+

content_format 2

Neatly padded table, titles only

+==========================================+ | - Intro | | - Screenshot | | - Install | | - Configuration | | - [Generate ToC](#Generate ToC) | | - Examples: | | - [content_format 3](#content_format 3) | | - [content_format 2](#content_format 2) | | - [content_format 1](#content_format 1) | +==========================================+

content_format 1

Titles only

  • Intro
  • Screenshot
  • Install
  • Configuration
  • [Generate ToC](#Generate ToC)
  • Examples:
  • [content_format 3](#content_format 3)
  • [content_format 2](#content_format 2)
  • [content_format 1](#content_format 1)