A plugin to dyamically generate and maintain a table of contents for you in real time.
There are various other ToC plugins for Obsidian, however, they come with certain limitations which this plugin aims to mitigate and improve upon which includes:
Seamless Integration & Dynamic Generation
- Just insert the code block and start typing. There's nothing more to it.
- Other ToC plugins generate the ToC via command activation.
- This plugin is designed for performance and simplicity for maximum convenience and organization.
Omit Specific Headings
- Exclude any heading you want from the ToC by simply adding
<!-- omit -->
to the end of the heading. - Alternatively, utilize the local settings to omit specific headings.
HTML & Special Symbols
- Feel free to include HTML or any kind of special symbols within headings. This plugin will handle these cases elegantly.
- You can additionally specify which characters should be escaped within the local settings.
Heading Hierarchy Handling
- Include any type of heading hierarchy you want. Your heading structure doesn't have to be any certain way.
- Other plugins will prohibit the ToC insertion if the heading hierachy is not in a particular optimal format.
Markdown Links & Wiki-Links
- This plugin will handle multiple of both markdown links (
[Title]\(https://link)
) and wiki-links ([[file-name.md]]
) within headings.
Settings
- Bullet Style - Select your preferred list-bullet style within the settings tab.
- Update Delay - Configure the delay between ToC updates.
- Exclusions - You will have multiple custimization choices pertaining to exlcuding specific heading text, individual characters, and heading levels.
- Indentation Width - Determine your preferred amount of indentation spacing.
- Local File Settings
General Usage
-
Insert the
insta-toc
code block:```insta-toc ```
Omit Specific Headings
-
If you want to omit a specific heading from the ToC, simply add
<!-- omit -->
to the end of the heading.# Heading 1 <!-- omit -->
-
Alternatively, utilize the local settings:
--- omit: [ "Heading 1", "Heading 2" ] ---
↕️ ↕️ ↕️ ↕️ --- omit: - Heading 1 - Heading 2 ---
Local ToC Settings Guide
⚠️ FORMAT CAUTION⚠️ The local settings use YAML formatting, which is a format that is very particular about perfect spacing. I'll be implementing auto-correction logic soon to account for this, but for the time being ensure that you are only indenting with 2 spaces, otherwise you will get errors.
-
Type Guide:
--- title: name: [string: any] - The title of the ToC. level: [number: 1 | 2 | 3 | 4 | 5 | 6] - The heading level of the title. center: [boolean: true | false] - Optionally center position of the title. exclude: [string: any | RegExp: /.../] - Exclude specific headings based on a string of characters (e.g., ",._-+=") or a regular expression (e.g., /[^a-zA-Z0-9]/). - NOTE: Currently, this will include global excluded characters as well. style: listType: [string: "number" | "dash"] - The type of list-bullet style. omit: [string[]: any[]] - Omit specific headings from the ToC. levels: min: [number: 1 | 2 | 3 | 4 | 5 | 6] - The minimum heading level to include in the ToC. max: [number: 1 | 2 | 3 | 4 | 5 | 6] - The maximum heading level to include in the ToC. ---
-
Example 1:
--- title: name: "Table of Contents" level: 2 center: false exclude: ",._-+" style: listType: "dash" omit: [ "Heading 1", "Heading 2" ] levels: min: 1 max: 3 ---
-
Example 2:
--- title: name: "Table of Contents" level: 1 center: true exclude: /[^a-zA-Z0-9]/ style: listType: number omit: - Heading 3 - Heading 4 levels: min: 2 max: 6 ---
- Open Obsidian and press
CMD+,
. - Navigate to the Community plugins tab and click the
Browse
button. - Navigate to the search bar and type
Insta TOC
- Click the install button.
- Install BRAT community plugin.
- Open Obsidian and press
CMD+SHIFT+P
. - Type
>BRAT: Plugins: Add a beta plugin for testing
and select the option. - Insert
https://github.com/iLiftALot/insta-toc
and submit.
npm install insta-toc
- Download the latest release.
- Extract the
insta-toc
folder from the zip to your vault's plugins folder:/path/to/<vault>/.obsidian/plugins/
. Note: On some machines the .obsidian folder may be hidden. On MacOS you should be able to pressCMD+SHIFT+.
to show the folder in Finder. - Reload Obsidian.
- Handle various heading formats
Markdown LinksWiki-LinksHTMLTagsSpecial Characters- ...
- Configure Settings Tab
IndentationBullet typesNumberDash- ...
ToC Update DelaySpecial Character Specificatio- Preferences for customized TOC appearance
- ...
- Improve ToC Interaction/Interface
Add folding capabilitiesAdd ability to exclude specific headingsAdd local setting capabilities- ...
- Configure specific formatting for various exporting circumstances
- HTML
- Markdown
- ...