Make [TOC] available in markdown

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.

3 Likes

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

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

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?

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


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:

2 Likes

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.

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 you mentioned earlier, but nobody likes people who hijack their thread…)

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.

2 Likes