Table of Content

I’m looking for a way to generate a Table of Content into a note file. I know there is the Outline feature, but I want something in the file itself.

Is there a way to either;

  • Inset the Outline feature into a file?
  • query just the headings of file?
  • A plugin that can give this option?
5 Likes

```query
/\s#{1,6} / Filename.md
```
I think you can use this regex for query.

1 Like

Sorry, but I can’t seem to work.

Does Filename.md need to be in the root dir with that formular? how would it look if the file was in sub folders and had spaces in the path name? Do i need to include the full path?

You need to rename the Filename with your notename
Ex: if i want to make the query for TOC of note obsidian
then it would be /\s#{1,6} / obsidian.md
I don’t think you need to have full path. I tested this in my vault and it seems ok.

1 Like

Sorry, that was my bad, I looked at it again after reading you last this reply and I noticed that when I pasted the formula in, it added an extra \ before the s. Didn’t notice this the first time around.
It’s almost what I’m after. I kinda groups them together as a drop down would rather it list each one as it’s own line item. Any way it will do for now.
Thanks.

2 Likes

You may like this request: Type [toc] for a ToC

Thanks.

4 Likes

@I-d-as: yes, I am aware of my own feature request. Nevertheless, an FR may never see the light of day, or in the very distant future.

What I asked Pys is not the same as the FR I submitted.

You can use the outline core plugin to generate a TOC-style outline in a separate pane i.e. the sidebar. It is automatically updated for you.

@davecan: I am aware and have had that core plug-in enabled from the day I started using Obs in May.

To repeat: that is not what I asked Pys.

I am a little confused now. I thought it was clear I was answering a help question and pointing someone in the direction of your idea from a while back which places the TOC within note as opposed to in Outline Pane.

@Klaas. Sorry for any confusion, but to be clear, I actually was linking to your request for the benefit of @TheTuxCrusader, who submitted the help topic.

Thanks

@I-d-as: the misunderstanding/mix-up is entirely on my side, for which I apologize.

Nevertheless, if you look at my comments in this thread and other threads, I always start my comment with @ and the person I am addressing so as to avoid precisely this kind of misunderstanding.

1 Like

@Klaas: No worries. I totally understand the mixup now that I see the topic about the css with pys.

I will try to start doing that from here on in unless the person whose thread I am linking to is already in the conversation. I always figured it was good enough to just use reply, but now see why the @ is actually a fail safe.

Thanks.

1 Like

@I-d-as: :+1:

1 Like

I think I may have created a plugin that does what you want. It isn’t dynamic but it’s easy to bind a hotkey to creating the TOC and just regenerating it.

2 Likes

There hasn’t been any activity for 5 days, could you please see if you’d like to pick any of the existing answers as the solution, or do you still need help with something?

Would appreciate it if you could clarify on that, thanks!

@hipstersmoothie: this is a great plug-in, many thanks. It seems to me that’s what @TheTuxCrusader was looking for. In any case, I was looking for it and am happy.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.