rcsaquino / obsidian-auto-filename

Auto Filename is an Obsidian.md plugin that automatically renames files in Obsidian based on the first x characters of the file, saving you time and effort.
MIT License
13 stars 4 forks source link

FR: Properly Handle Templater Syntax #15

Open greetclammy opened 1 month ago

greetclammy commented 1 month ago

I'm requesting an enhancement to your plugin to correctly handle 'Templater' syntax. Specifically, the plugin should:

  1. Ignore 'Templater' commands when determining the first line content, especially <% tp.file.cursor(1) %>.
  2. Wait for 'Templater' to finish executing before applying the auto-filename logic.
  3. Correctly handle the frontmatter created by 'Templater'.

Here's my 'Templater' template for all new notes: --- created: <% tp.date.now("YYYY.MM.DD HH:mm") %> modified: <% tp.date.now("YYYY.MM.DD HH:mm") %> tags: --- <% tp.file.cursor(1) %> <%* tp.hooks.on_all_templates_executed(async () => { app.workspace.activeLeaf.view.editor.focus(); }); -%>

Currently, 'Auto Filename' renames all new notes to <% tp.file.cursor(1) %> upon creation. Granted, it 'corrects' itself in a moment by replacing <% tp.file.cursor(1) %> with "Untitled (#)". Still, ideally, it should not put any 'Templater' syntax to title, even if for a moment. This enhancement would ensure seamless integration between your plugin and 'Templater', improving the overall user experience.

Thank you for considering this request.