Prompting for input using core Templates plugin

Use case or problem

When creating a new note from a template using the core Templates plugin, there are instances where I want to ensure that a note body or property has a value present.

Proposed solution

I am proposing some new variables that could be added to trigger a prompt for a user to complete.

  • {{prompt:What is the name of this person?:string}} — Prompts the user to enter some text. The prompt text presented to the user would be what follows after the colon (:) and the property type for the provided value would come after the second colon. The property type could be omitted and would default to string. The property type could help ensure that the correct type is used when {{prompt}} is used in the value of a property in the template (e.g. validation or knowing to use a date picker).
  • {{file:Choose a category for this recipe:[parent:Cusines]}} — Prompts the user to choose a note from the list presented. The prompt text presented to the user would be what follows after the first colon (:) and the search query used to find the notes would come after the second colon. A search query could be omitted to present all notes in the vault as an option, allowing the user to enter their own search query.

Current workaround (optional)

The current workaround is to use a plugin like Templater with a custom script.

2 Likes