johansatge / obsidian-automatic-table-of-contents

💠 An Obsidian plugin to create a table of contents in a note, that updates itself when the note changes
MIT License
123 stars 11 forks source link

Add option to hide an empty TOC #51

Open Tholleman opened 1 month ago

Tholleman commented 1 month ago

I've got the TOC in my template but don't like the look of the warning when there are no headings. My proposed solution is a new option that hides the TOC in that case

```table-of-contents
hideWhenEmpty: true
```

which would hide the warning: Table of contents: no headings found

Tholleman commented 1 month ago

Not entirely sure what should happen to the title in this case. I don't use it so I have no strong preference. If "hideWhenEmpty" is the name of the option then it should also hide the title. If the option is instead named "hideWarning" then you should still render the title.