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
--langdef=markdown
--langmap=markdown:.md.markdown.tmd
--regex-markdown=/^(# \S.*)/\1/h,h1/

--regex-markdown=/^\s*\/\/\s*(TODO.*$)/\1/h,todo/

--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"]

Enjoy

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 *

*

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

  • Recent Posts

  • Picks

  • Boxing Clock for AndroidOcton8 Diving T-ShirtsShaking Tower Panda Android GameLearn Chinese with Android
  • Student projects