Use case or problem

I create dozens of new notes a week and they’d all be named Untitled {number} if I didn’t specifically click the title bar and name them.

Proposed solution

I’d like the first 5-7 words of the note to auto-populate to the note title. This would often correspond to the top-level header of the note anyway.

For instance if I create a note that starts with the header

# Dishwasher Repair Tips

the note would just be automatically titled Dishwasher Repair Tips unless I change it, rather than Untitled.

I’m curious if there’s a CSS solution to this.

I realize this may run into problems with filename rules. Perhaps the auto-population could remove illegal filename characters.

Current workaround (optional)

No workarounds, just manual entry.

Related feature requests (optional)

You can accomplish this with the Templater plugin.

I have turned on the option to allow Templater to trigger on new file creation. My new notes use the following template:

<%*
  let title = tp.file.title
  if (title.startsWith("Untitled")) {
    title = await tp.system.prompt("Title");
    await tp.file.rename(`${title}`);
  } 
  tR += "---"
%>
tags: Note <%tp.file.creation_date("YYYY")%>
---
# <%* tR += `${title}` %>

<% tp.file.cursor() %>

___

## References:
- 

---
creation date:: [[<%tp.file.creation_date("YYYY-MM-DD")%>]] <%tp.file.creation_date("HH:mm")%>

The script in the template asks for a name if the note is untitled and then renames the note with the title and puts it in a header at the top of the note.

This script is not my concoction. I modified one that I found elsewhere–but I forget where.

I hope it helps!

7 Likes

Oh cool! Thanks I’ll try this out. I haven’t used Templater so this looks like a good introduction.

In some cases, I’m copy and pasting into a note. I wonder if there’s a way to take the first few words from the pasted text. I guess it’s probably not possible, since it would have to wait for the first text to show up. (Not sure how Joplin does it.)

However this plugin will save me a lot of time with 80% of my notes. Thanks!

1 Like