I started to use markdown to take notes.
I use marked to view my markdown notes and its beautiful.
But as my notes get longer I find it diff
If you happen to use Eclipse you can use the Ctrl+O (outline) shortcut, this will show the equivalent of the table of contents and allow to search in section titles (autocomplete).
You can also open the Outline view (Window -> Show View -> Outline) but it has no autocomplete search.
There is a Ruby script called mdtoc.rb that can auto-generate a GFM Markdown Table of Contents, and it is similar but slightly different to some other scripts posted here.
Given an input Markdown file like:
# Lorem Ipsum
Lorem ipsum dolor sit amet, mei alienum adipiscing te, has no possit delicata. Te nominavi suavitate sed, quis alia cum no, has an malis dictas explicari. At mel nonumes eloquentiam, eos ea dicat nullam. Sed eirmod gubergren scripserit ne, mei timeam nonumes te. Qui ut tale sonet consul, vix integre oportere an. Duis ullum at ius.
## Et cum
Et cum affert dolorem habemus. Sale malis at mel. Te pri copiosae hendrerit. Cu nec agam iracundia necessitatibus, tibique corpora adipisci qui cu. Et vix causae consetetur deterruisset, ius ea inermis quaerendum.
### His ut
His ut feugait consectetuer, id mollis nominati has, in usu insolens tractatos. Nemore viderer torquatos qui ei, corpora adipiscing ex nec. Debet vivendum ne nec, ipsum zril choro ex sed. Doming probatus euripidis vim cu, habeo apeirian et nec. Ludus pertinacia an pro, in accusam menandri reformidans nam, sed in tantas semper impedit.
### Doctus voluptua
Doctus voluptua his eu, cu ius mazim invidunt incorrupte. Ad maiorum sensibus mea. Eius posse sonet no vim, te paulo postulant salutatus ius, augue persequeris eum cu. Pro omnesque salutandi evertitur ea, an mea fugit gloriatur. Pro ne menandri intellegam, in vis clita recusabo sensibus. Usu atqui scaevola an.
## Id scripta
Id scripta alterum pri, nam audiam labitur reprehendunt at. No alia putent est. Eos diam bonorum oportere ad. Sit ad admodum constituto, vide democritum id eum. Ex singulis laboramus vis, ius no minim libris deleniti, euismod sadipscing vix id.
It generates this table of contents:
$ mdtoc.rb FILE.md
#### Table of contents
1. [Et cum](#et-cum)
* [His ut](#his-ut)
* [Doctus voluptua](#doctus-voluptua)
2. [Id scripta](#id-scripta)
See also my blog post on this topic.
Typora generates Table of Content by adding [TOC]
to your document.
Here's a useful method. Should produce clickable references in any MarkDown editor.
# Table of contents
1. [Introduction](#introduction)
2. [Some paragraph](#paragraph1)
1. [Sub paragraph](#subparagraph1)
3. [Another paragraph](#paragraph2)
## This is the introduction <a name="introduction"></a>
Some introduction text, formatted in heading 2 style
## Some paragraph <a name="paragraph1"></a>
The first paragraph text
### Sub paragraph <a name="subparagraph1"></a>
This is a sub paragraph, formatted in heading 3 style
## Another paragraph <a name="paragraph2"></a>
The second paragraph text
Produces:
Some introduction text, formatted in heading 2 style
The first paragraph text
This is a sub paragraph, formatted in heading 3 style
The second paragraph text
If you want to use a javascript/node.js tool, take a look at markdown-toc.
Anchor tags generated by different Markdown parsers are not even.
If you are working with Markdown parsers GFM (GitHub Flavored Markdown) or Redcarpet, I wrote a Vim plugin to handle table of contents.
Generate table of contents for Markdown files.
Supported Markdown parsers:
Update existing table of contents.
Auto update existing table of contents on save.
Generate table of contents
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.
:GenTocGFM
Generate table of contents in GFM link style.
This command is suitable for Markdown files in GitHub repositories, like README.md, and Markdown files for GitBook.
:GenTocRedcarpet
Generate table of contents in Redcarpet link style.
This command is suitable for Jekyll or anywhere else use Redcarpet as its Markdown parser.
You can view here to know differences between GFM and Redcarpet style toc links.
Update existing table of contents manually
Generally you don't need to do this, existing table of contents will auto update on save by default. If you want do it manually, just use :UpdateToc
command.
https://github.com/mzlogin/vim-markdown-toc