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:
Here:
Added this code:
addTitle: {
type: 'boolean',
default: true,
comment: 'Include a title Table of Contents',
},
and here:
added/modified:
let markdown = getMarkdownFromHeadings(headings, options)
instead of
const markdown = getMarkdownFromHeadings(headings, options)
and
if (options.addTitle) markdown = '## Table of Contents\n' + markdown
Finally, add the TOC block to your note:
```table-of-contents
```
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.