Ouch :sweat_smile:

I think it should work now if you get the latest version - fingers crossed! This includes the main.js file.

I’ve now made a proper release here:

I’ve also expanded the plugin functionality a bit - you can configure what the selected text gets replaced with, and also autofill the text boxes with parts of the selection:

TemplateDemo

There’s quite an overlap with @Christian’s Quick Add plugin - I probably wouldn’t have made this if I’d found that first! I think there’s a different focus here, though - it’s very minimal and all the config is in the markdown templates.

2 Likes

New release!

0.1.5

Lots of new configuration - whether to replace text or not, whether to create notes and open in new panes, template changes load without reloading obsidian, new fields

2 Likes

New release - lots of updates:

  • Templates now loaded dynamically - no more restarts! (also: changed template folder selection to dropdown,command for re-indexing)
  • Added a choice type, e.g. {{suit:choice:hearts:spades:diamonds:clubs}}
  • Note filenames are now generated from a template string, either in config, or in template-filename in the template. Defaults to {{title}}, but all template fields available.
  • Added multiple replacement text possibility - If an array is given for template-replacement, then these will all be options in the template dialog
  • Many UI tweaks, fixed YAML parsing
1 Like

Hello @mo-seph , the updates look great, thanks! A lot of amazing improvements. But have you had any problem loading dynamically the commands? I use a lot of plugins here (23) and maybe other plugin is messing with it (or maybe it’s an Obsidian configuration) but unfortunately FromTemplate is not being able to create commands and show them on command palette (Ctrl-P). And it’s not throwing any error message on console (Ctrl-Shift-I)…

I even tried the “Re-index templates” command but without success.

Quick check - are you in edit mode? I only see the template commands when I’m editing markdown.

Edit mode:

Preview mode:

Thank you, @mo-seph . Didn’t know that. Is there a reason for that? One great usage (and it worked here for a day or less) was using a Button to fire a form and create a new note. It was so beautiful… :disappointed_relieved:

1 Like

Dear @mo-seph , another point: does the behavior changed in relation to frontmatter (YAML)? I guess (I’m not sure) the previous version was able to replace fields in frontmatter but the 0.1.6 doesn’t seem able to do it. Thanks!

It should work. There is a behaviour change, though - the frontmatter now needs to be proper YAML, which means values can’t start with { otherwise they are read as empty dictionaries (YAML would support address: {street: Baker, number 221b} for example). So you have to change

key: {{value}}

to use quotes:

key: "{{value}}"

I’ve updated the docs to mention this, as it surprised me!

If that doesn’t work, though, there’s a problem

1 Like

Can you share how you make that work? I didn’t know it was possible, and it sounds great!

1 Like

Thanks, @mo-seph, for the info about YAML. Didn’t know that. I confirm it’s working great now.

About the button, all I did was creating a button with “Buttons: Button Maker” dialog. It worked beautifully but only for some hours, I don’t know why:

```button
name New Partner (Form)
type command
action From Template: New Partner - FORM

^button-buttonNewPartnerForm

Hello @mo-seph (et al), I tried to create a macro (using macro plugin) to toggle to edit mode, call the form and toggle back to preview mode (read mode). Unfortunately I couldn’t find a command that worked (to toggle between edit and preview (read) mode). Bye!

I like the plugin. A small feature I noticed that when I invoke a template with “tags” or “aliases” (pre-populated or not) in the YAML they are removed from the note created. I can get around this by making these YAML required for population.

I don’t know if this is fixed with the new editor? It certainly lets me be in the preview/edit mode where everything looks nice, but still use the plugin.

Ah - that could be down to my YAML handling (at some point, I brought in a YAML library rather than going through it by hand, but it seems to have made life much more complicated for cases like this) - I’ll have a look.

Can you share an example template? I started an issue here: https://github.com/mo-seph/obsidian-note-from-template/issues/21

1 Like

Is it possible to add the ability to have a default in a choice selection? For example I have a field defined as

Subscription Type: {{subscription type:choice:Streaming:Software}}

Would it be possible to have “Streaming” or “Software” preselected as the default?

This is probably a fringe use case but is it possible to put a frontmatter selection into the note body? For example, in the frontmatter I have


subscription-type: “{{subscription type:choice:Streaming:Software}}”

In the note I would like to reference subscription-type value from the frontmatter. How would I do this?

Thanks!

Hard code it in the template. If I had two similar topics I regularly created notes on, but a field varied between the two, I would make two near-identical templates with these fields hard coded in the template.