Clickable Table of Contents for Markdown – Ctags with Gedit

MarkDown is a very fast way to write text. You just mark headings with hash “#”. Empty line creates paragraph.
This tutorial shows how you can create a clickable table of contents of your MarkDown document – right inside your text editor. This makes it easier to edit long documents.

Use Tero’s Markdown Rules for Ctags

$ sudo apt-get install ctags
$ nano $HOME/.ctags
$ cat .ctags
--regex-markdown=/^(# \S.*)/\1/h,h1/
--regex-markdown=/^(# \S.*)/\1/h,toc/
--regex-markdown=/^(## \S.*)/. . . . \1/h,toc/
--regex-markdown=/^(### \S.*)/. . . . . . . . \1/h,toc/
$ ctags --list-maps|grep -i markdown
markdown *.md *.markdown *.tmd

Install into Gedit

$ sudo apt-get -y install gedit gedit-source-code-browser-plugin

Open Gedit

  • Gedit: Edit: Preferences: Plugins: Source Code Browser: enable
  • Gedit: F9. Source code.
  • Gedit: Open: [any markdown document with hash ## headings – and name ending with “.md”]


You now have double-clickable table of contents for your MarkDown documents. And there is even a double-clickable list of TODOs.

Posted in Uncategorized | Tagged , , , , , , , | Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *