Table of Contents like Typora

Finally, I was able to replicate the Table of Contents like it is done in Typora.
I modified the plugin “Automatic Table of Contents”, and now happier than ever.

Changes over main.js under the plugins folder:


Added this code:

  addTitle: {
    type: 'boolean',
    default: true,
    comment: 'Include a title Table of Contents',

and here:


let markdown = getMarkdownFromHeadings(headings, options)

instead of

const markdown = getMarkdownFromHeadings(headings, options)


if (options.addTitle)  markdown = '## Table of Contents\n' + markdown

Finally, add the TOC block to your note:



No need to specify addTitle: true because it’s true by default.

It will looks like this:

By default addTitle is true. But you could change to false in the bloc.

I have already submitted a gentle pull request.


By the way, the author of the package has already included the code I suggested. Now the “Table of Contents” can be added after updating the plugin from Obsidian plugins. The string can be entered in markdown. For instance, I use title: ## Table of Contents. Pretty neat!