# Make \[TOC\] available in markdown

**URL:** https://discourse.joplinapp.org/t/make-toc-available-in-markdown/20
**Category:** Features
**Created:** [27 April 2018 09:30 UTC](https://discourse.joplinapp.org/t/make-toc-available-in-markdown/20 "2018-04-27T09:30:33Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![tessus](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/tessus/32/13_2.png) [@tessus](https://discourse.joplinapp.org/u/tessus)
#### Post date: [27 April 2018 09:30 UTC](https://discourse.joplinapp.org/t/make-toc-available-in-markdown/20/1 "2018-04-27T09:30:33Z")

</div>

I often have long notes and a Table of Contents would help a lot with navigating these notes.

I’ve come across several markdown implementations which allow the use of a `[TOC]` keyword. In the rendered text it is replaced by a generated Table of Contents.

What do you think? Does this feature make any sense, or is this something only I find useful? I’ve noticed that it isn’t possible to create links to other sections within a note, so I guess this would have to be implemented first.

---

<div class="post-metadata">

### Author: ![laurent](https://avatars.discourse-cdn.com/v4/letter/l/ce7236/32.png) [@laurent](https://discourse.joplinapp.org/u/laurent)
#### Post date: [27 April 2018 19:29 UTC](https://discourse.joplinapp.org/t/make-toc-available-in-markdown/20/2 "2018-04-27T19:29:37Z")

</div>

There’s an issue about it on GitHub: [https://github.com/laurent22/joplin/issues/263](https://github.com/laurent22/joplin/issues/263)

The first step indeed would be to create links between notes and within notes.

---

<div class="post-metadata">

### Author: ![tessus](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/tessus/32/13_2.png) [@tessus](https://discourse.joplinapp.org/u/tessus)
#### Post date: [27 April 2018 21:58 UTC](https://discourse.joplinapp.org/t/make-toc-available-in-markdown/20/3 "2018-04-27T21:58:58Z")

</div>

Ah, I see. I missed this issue because of its strange title `New entry type "Chapter"`.

The common markdown keyword for a table of contents section (collapsible or not) is `[TOC]`. The reason for a keyword is that people might want to have it at the top and the bottom of a note (or somewhere within the note as well).  
But the option for adding an “additional” GUI feature so that one can fade in the TOC separately or even pin it to the left side of the note, is a different story.

Unless you want to discuss these 2 things in one ticket… But in this case we should make it absolutely clear that they are not the same thing. One is rendering a TOC when `[TOC]` is encountered, and the the other one is a GUI feature. These are actually 2 feature requests.

P.S.: Discourse issue: There’s no way to mark a discussion as resolved or pick a reply as the solution. Or do these options only show up after a few posts?

---

<div class="post-metadata">

### Author: ![tessus](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/tessus/32/13_2.png) [@tessus](https://discourse.joplinapp.org/u/tessus)
#### Post date: [27 April 2018 22:23 UTC](https://discourse.joplinapp.org/t/make-toc-available-in-markdown/20/4 "2018-04-27T22:23:38Z")

</div>

Btw, the following 2 links could help to implement this:

> **[jonschlinkert/markdown-toc](https://github.com/jonschlinkert/markdown-toc)**
>
> Generate a markdown TOC (table of contents) for a README or any markdown files, using remarkable. Used by assemble, verb, and lots of other projects on GitHub. API and CLI. - jonschlinkert/markdown...

  

> **[gajus/contents](https://github.com/gajus/contents)**
>
> Table of contents generator. Contribute to gajus/contents development by creating an account on GitHub.

---

<div class="post-metadata">

### Author: ![laurent](https://avatars.discourse-cdn.com/v4/letter/l/ce7236/32.png) [@laurent](https://discourse.joplinapp.org/u/laurent)
#### Post date: [28 April 2018 09:28 UTC](https://discourse.joplinapp.org/t/make-toc-available-in-markdown/20/5 "2018-04-28T09:28:44Z")

</div>

The Markdown approach would indeed be simpler than creating custom UI for all three apps. Since we use markdown-it, this plugin maybe could be used:

> **[Oktavilla/markdown-it-table-of-contents](https://github.com/Oktavilla/markdown-it-table-of-contents)**
>
> A table of contents plugin for Markdown-it . Contribute to Oktavilla/markdown-it-table-of-contents development by creating an account on GitHub.

---

<div class="post-metadata">

### Author: ![tessus](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/tessus/32/13_2.png) [@tessus](https://discourse.joplinapp.org/u/tessus)
#### Post date: [29 April 2018 21:44 UTC](https://discourse.joplinapp.org/t/make-toc-available-in-markdown/20/6 "2018-04-29T21:44:28Z")

</div>

I’m not saying that the GUI changes aren’t a great idea. I’d love to see them at one point in the future. These 2 things are not mutually exclusive and I can see the advantages of being able to pin the TOC to the left side of the note.

However, it’s way easier to just add a plugin.

One of the reasons why a TOC is so important is because the cursor position within a note is not saved. Every time I switch to or open another note, the cursor jumps to the top. I don’t know, if this is a bug or intentionional, but it’s quite problematic. especially with long notes and when you are editing a subsection in the middle and you have to switch back and forth between notes.

---

<div class="post-metadata">

### Author: ![tessus](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/tessus/32/13_2.png) [@tessus](https://discourse.joplinapp.org/u/tessus)
#### Post date: [30 April 2018 22:02 UTC](https://discourse.joplinapp.org/t/make-toc-available-in-markdown/20/7 "2018-04-30T22:02:12Z")

</div>

What is the process now? What are the next steps?

Shall I open a new ticket on github and reference this discussion? (I could also use the [ticket](https://github.com/laurent22/joplin/issues/263) you mentioned earlier, but nobody likes people who hijack their thread…)

---

<div class="post-metadata">

### Author: ![laurent](https://avatars.discourse-cdn.com/v4/letter/l/ce7236/32.png) [@laurent](https://discourse.joplinapp.org/u/laurent)
#### Post date: [1 May 2018 08:47 UTC](https://discourse.joplinapp.org/t/make-toc-available-in-markdown/20/8 "2018-05-01T08:47:34Z")

</div>

Yes if you could create a new ticket and link to this discussion that would be great. It’s indeed different from the GUI feature so should be a separate ticket.

---

<div class="post-metadata">

### Author: ![tessus](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/tessus/32/13_2.png) [@tessus](https://discourse.joplinapp.org/u/tessus)
#### Post date: [1 May 2018 18:43 UTC](https://discourse.joplinapp.org/t/make-toc-available-in-markdown/20/9 "2018-05-01T18:43:10Z")

</div>

> <https://github.com/laurent22/joplin/issues/478>
