I use an H1 at the start of every file, and I’d like to have one source of truth as to what any certain file is called. Right now I have to manage both the filename and H1 at the start of the file, to keep them in sync. I’d love a plugin option to make it so I don’t have to bother with the filename, where I can trust that the filename is always going to reflect whatever the first line says.
I’m experiencing the same problem and I would appreciate a solution. Your suggestion sounds reasonable.
I simply skip having a document title in the document itself and rely on the filename being displayed at the top. But this doesn’t translate when opening the file in another program.
I do the exact same thing. All my files begin with an H1. Sometimes I rename a file or decided to change the header and I end up having to make sure all headers and file names are synced.
For what it’s worth I noticed when using the Notation Theme, the name of the file is formatted in CSS to appear as the header of a file which I like. This way you wouldn’t need to add an H1 at the start of each file and when you update the name of the file it updates the “header” as well.
That’s a really neat way of solving the “single source of truth” issue, but I much prefer the file itself to have a title embedded within it. Therefore I want the document content itself to be the single source of truth.
I’ve also noticed this problem with that theme when the filename is longer. I don’t know that there’s a way to work around the DOM structure to fix this at the moment.
Similar features are in Drafts and Notes. When making a note in either app, there is no “title” for the note. The “title” is the first line of the note.
For Obsidian we could have an optional user preference that automatically prepends the title to the first line of the note as an H1.