Optional display of titles (aka. deduplicate first heading)

Use case or problem

The inline displaying of titles since release 0.16.0 is lovely! It makes titles a more integral part of every note.

However for historical reasons people have been using workarounds (sometimes even plugins) to achieve this, which now results in duplicated titles (note title + identical first heading) for many existing vaults.

Proposed solution

In the Settings → Editor → Display category change the Show inline title setting from a toggle to a 3-way menu:

  • always
  • unless identical to topmost heading
  • never

The middle setting could provide a clean transitional period, until old notes are reworked across the vault.

Current workaround (optional)

Manually go through the vault and delete redundant first headings, possibly also raising all heading levels by 1. Or just learn to live with duplicate titles.

apparently there already is a new setting

Where is the new setting? I cannot seem to find it in 0.16.2.

The poster already knows about that setting — they’re asking for it to be expanded.

1 Like

I know there’s an in-built solution for this, but if you or anyone else are still looking for an alternative workaround, I’ve worked out that you can delete the redundant headers and raise the heading levels by using regex in VSCode.

  1. Open vault in VSCode (manually or through this plugin).
  2. Find and replace in all files Ctrl+Shift+H.
  3. To delete title header, use this regex search string: ^#\s.*$\n. Leave the replace field blank, and click replace.
    Note: This will delete all first-level headings. This is fine for me because I only use first-level headings for titles, but if you use them for other text, they will be deleted too. You’ll have to figure out another search string specific to your title header (e.g. if you use metadata then you can add ---).
  4. To raise all heading levels, find ^## and replace with #.

I prefer this method because I’m against redundancy. Also, since I’m only using {{title}} instead of plugins, it’s far more convenient to use Obsidian’s feature, now that it’s (or will be, since I’m not an insider) available.

And/or “unless H1 is already present at top” may be more/also appropriate. (Heading content does not have to match file name).

Cf. Obsidian Titles/Headers - #7 by robertandrews