Template Plugin

How do I do that within discourse or should i post an link to external poll?

1 Like

Thanks, created a poll. Opinion on the templates should be organized - #3 by nishantwrp

Please take a look at Deprecating pre-installed template feature

Important Links

1 Like

Updated Plan

Week 1

  • Initialize Plugin Framework
  • Setup Github Actions
    • Lint Checks
    • Build Checks
    • TypeScript Check (If not covered by above checks)
    • Unit Tests if needed further
  • Implement Notebook System
  • Created a command to expose joplin prompt to plugins

Week 2

  • Create the basic newNote, newTodo, insertText options.

Week 3

  • Work on default templates functionality.

Week 4

  • Complete default templates functionality.
  • Introduce handlebars and make sure all the current templates are compitable with the plugin.

Week 5

  • Create UI for variable input component.

Week 6

  • Write parsers for variable syntax.

Week 7

  • Complete variable feature.

Week 8, 9, 10

  • Finalize the way to handle the transition of users to this plugin.
  • Update documentation.
  • Finalize and implement the way to store the templates. (Tags, notebook, etc.)
  • Removal of original feature from the main codebase.
  • Release the final version of the plugin.
1 Like

Thanks for the updated plan, but note that removing the feature from the codebase may take a bit more time than you think as there will be a review process.

It's also key to your project because if the feature is still there by the time you finish, there's no need for the plugin at all. So what I would suggest is to create a pull request to remove the feature as soon as you can. That will get things started, then the reviewing process can happen in parallel to your other tasks.

1 Like

Yup sure, I'll try to create the PR next week. Just to be clear, The PR will be merged only after the plugin is complete, right?

Once it's ready it will be merged, but it will be in a separate branch so that we can test without having to make it part of an official release (or pre-release).

1 Like
2 Likes

All good here, thanks for a such a convenient and well implemented plug-in.

Do custom variable definitions need particular fencing? I directly copied your example, and it doesn't work as expected.

Test template

Date: {{date}}

Time: {{time}}

Datetime: {{datetime}}

Custom Datetime: {{#custom_datetime}}MMMM YYYY, h:mm:ss a{{/custom_datetime}}

Date of beginning of week: {{bowm}}

# Create custom variable example

---
name: text
color: enum(Red, Yellow, Green)

---

Hi there, {{ name }}. Your favorite color is {{ color }}. This note/to-do was created on {{ datetime }}.

Result

Date: 2021-08-07

Time: 7:41 PM

Datetime: 2021-08-07 7:41 PM

Custom Datetime: August 2021, 7:41:54 pm

Date of beginning of week: 2021-08-02

# Create custom variable example

---
name: text
color: enum(Red, Yellow, Green)

---

Hi there, . Your favorite color is . This note/to-do was created on 2021-08-07 7:41 PM.

I'm using joplin Joplin 2.1.9 (prod, win32)
I'm told when I try to upgrade that I have the latest version.
When I try and install your template I get this notice:
upgrade notice

Not sure what to do now.

@SteveShank
From the release post

  • Update to the latest pre-release of the desktop application i.e. 2.2.5 .

@johano

You have text bevor the fence block, witch starts and ends with ---.
In the exaple is the folowing code:

---
name: text
color: enum(Red, Yellow, Green)

---

Hi there, {{ name }}. Your favorite color is {{ color }}. This note/to-do was created on {{ datetime }}.

1 Like

Thanks Jack. I just glanced at it assured that I knew how to install a plugin.

Thanks, @JackGruber, all works fine now. I didn't understand the custom variables must be declared right at the start of the note and --- is the fence mark used.

Thanks for this plugin, installed it today and it works great!

1 Like
  • Is it possible to set the name/title of the note from the template? I want the name of the template to be the current date for instance.

  • Any way to create a note directly from a template without creating an empty note then applying a template?

  • Any way to modify how the date is represented? Currently, it is mm/dd/yyyy unlike it is shown in the doc 2019-01-01

  • Is it possible to position the caret after the template applied?

  • It would be nice to put the templated note under certain folder automatically.

1 Like

This one is opened as an enhancement request here: Option for note title in template · Issue #16 · joplin/plugin-templates · GitHub

You can do this from Tools > Templates > Create note from template or set a template as your default note template if you want to use a keyboard shortcut. I opened a request for a keyboard shortcut for the general case.

It seems the date is picking up the setting from Joplin. Preferences > General > Date format. Note, I had to restart Joplin to get this to be applied.

Not sure about these, but I agree both would be nice :slight_smile:

2 Likes

You mean the cursor? If yes, I don't know if that's possible with the plugin api. Maybe @laurent can tell that.

1 Like

You mean all your templates are stored in a single notebook? Initially, it was done that way. But the UX seemed not very simple. (Using a notebook instead of a folder to store the templates can cause various issues · Issue #12 · joplin/plugin-templates · GitHub)

1 Like