
This plugin search headings in document and insert TOC(Table Of Contents) to it.
- Insert TOC depending on headings in document
- TOC reflects contents from below its position or cursor (when you select "Insert TOC" menu)
- Auto linking when heading has anchor
- Refresh contents when file is saving
- Depth control
- Auto link (useful on Github etc.)
# Heading 0
Headings before MarkdownTOC tags will be ignored.
<!-- MarkdownTOC autolink=true bracket=round -->
- [Heading 1](#heading-1)
- [Heading 2](#heading-2)
- [Heading 3](#heading-3)
- [Heading with anchor](#with-anchor)
<!-- /MarkdownTOC -->
# Heading 1
...
## Heading 2
...
## Heading 3
...
# Heading with anchor [with-anchor]
...
With Package Control:
- Run “Package Control: Install Package” command, find and install
MarkdownTOC
plugin. - Restart ST.
With Git:
for SublimeText 2 (Mac)
git clone git@github.com:naokazuterada/MarkdownTOC.git ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/MarkdownTOC
for SublimeText 3 (Mac)
git clone git@github.com:naokazuterada/MarkdownTOC.git ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/MarkdownTOC
Without any dependencies:
- Download zip and expand it.
- Open ST's "Packges" directory (Sublime Text > Preference > Browse Packages...).
- Move "MarkdownTOC" directory into "Packages" directory.
- Open Markdown files.
- Move cursor to position where you want to insert TOC.
- Tools > MarkdownTOC > Insert TOC
- TOC has inserted into document!
- Update contents and save...
- TOC has been updated.
Don't remove the comment tags if you want to update every time saving.
attributes | values | defaults | keys in settings |
---|---|---|---|
autolink | true orfalse |
false |
default_autolink |
bracket | square orround |
square |
default_bracket |
depth | uint (0 means "no limit") |
2 |
default_depth |
You can set default values. Preference > Package Settings > MarkdownTOC > Settings - User
MarkdownTOC.sublime-settings
{
"default_autolink": false,
"default_bracket": "square",
"default_depth": 2
}
All attributes can be overridden in each TOC open tags like...
<!-- MarkdownTOC depth=2 autolink=true bracket=round -->
This will be useful on Github.
<!-- MarkdownTOC autolink=false -->
- MarkdownTOC Plugin for Sublime Text
- Feature
- Feature
- Feature
<!-- /MarkdownTOC -->
<!-- MarkdownTOC autolink=true -->
- [MarkdownTOC Plugin for Sublime Text](#markdowntoc-plugin-for-sublime-text)
- [Feature](#feature)
- [Feature](#feature-1)
- [Feature](#feature-2)
<!-- /MarkdownTOC -->
square: according to "Reference-style links".
<!-- MarkdownTOC bracket=square -->
- [Heading][heading]
<!-- /MarkdownTOC -->
round: according to Github style.
<!-- MarkdownTOC bracket=round -->
- [Heading](#heading)
<!-- /MarkdownTOC -->
You can control TOC depth.
<!-- MarkdownTOC depth=2 -->
- foo
- bar
- buz
- qux
<!-- /MarkdownTOC -->
<!-- MarkdownTOC depth=3 -->
- foo
- bar
- qux
- quux
- buz
- qux
<!-- /MarkdownTOC -->