Skip to content

FR: 3-way-sync (H1, Title, Filename) with regex prefix handling #1418

@kl2111

Description

@kl2111

Is Your Feature Request Related to a Problem? Please Describe.

Yes. Many users, especially those using Zettelkasten or timestamp-based notes, use a prefix in their filenames (e.g., YYYYMMDDhhmm_). The problem is that Linter's current title-related rules apply to the entire filename. This means if I want to sync my filename with my H1 or frontmatter title, the ugly prefix (e.g., 202510291209_) gets synced as well. I'm always frustrated that I cannot have a clean H1/frontmatter title that stays in sync with the semantic part of my filename.

Describe the Solution You'd Like

I would like a new rule (or an enhancement to the existing "YAML Title" rule) that enables 3-way synchronization between the H1 heading, the title key in the frontmatter, and the filename, while ignoring a specified regex prefix in the filename.

This rule would need a new setting: "Regex prefix to ignore in filename".

The sync should be multi-directional:

  1. If I change the filename: The plugin should strip the prefix, and update the H1 and frontmatter title with the rest of the name.
  2. If I change the H1: The plugin should update the frontmatter title and the filename. When updating the filename, it must preserve the original prefix.
  3. If I change the frontmatter title: The plugin should update the H1 and the filename. When updating the filename, it must preserve the original prefix.

Please include an example where applicable:

My Regex Setting: ^\d{12}_

Scenario: User changes the H1 Heading

(File is currently named 202510291209_My Old Note.md)

---
title: My Old Note
---

# My New Note

This is my note.

Expected Linter outcome:

  1. Linter detects the H1 change.
  2. It updates the frontmatter title to "My New Note".
  3. It updates the filename, preserving the prefix, to 202510291209_My New Note.md.

Result:

---
title: My New Note
---

# My New Note

This is my note.

(And the file is renamed)

Describe Alternatives You've Considered

I have considered the File Title Updater plugin, but it does not support ignoring prefixes; it syncs the entire filename. I have also tried the existing Linter rules (like "YAML Title" with the "Filename" mode), but they are one-way (Filename -> Title) and do not handle the multi-directional sync I need (e.g., H1 -> Filename).

Additional Context

This feature would be incredibly valuable for anyone using a Zettelkasten (timestamp-based) naming convention. It bridges the gap between having a machine-readable, unique filename (for sorting and ID) and a human-readable, clean title (for reading and linking).

Metadata

Metadata

Assignees

No one assigned

    Labels

    rule suggestionSuggestion to add or edit a rule

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions