You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+312-3Lines changed: 312 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,8 @@
10
10
11
11
This plugin allows you to create templates in Joplin and use them to create new notes and to-dos.
12
12
13
+
> **📚 New to the plugin?** Check out the [Complete Feature Demonstration Template](DEMO_TEMPLATE.md) to see all features in action with examples and expected outputs.
14
+
13
15
## Table of contents
14
16
15
17
-[Installing Plugin](#installing-plugin)
@@ -23,7 +25,16 @@ This plugin allows you to create templates in Joplin and use them to create new
23
25
-[Custom variables](#custom-variables)
24
26
-[Advanced Usage](#advanced-usage)
25
27
-[Special variables](#special-variables)
28
+
-[Advanced Template Features (Helpers)](#advanced-template-features-helpers)
-[Using notebooks to store templates](#using-notebooks-to-store-templates)
28
39
-[Changelog](#changelog)
29
40
-[Supporting](#supporting)
@@ -142,20 +153,22 @@ These are the variables that have a specific purpose other than being used in te
142
153
- Both built-in and custom variables can be used while defining these variables.
143
154
- The values of these variables can be used in the template body just like built-in and custom variables.
144
155
145
-
Currently there are two special variables.
156
+
Currently there are four special variables.
146
157
147
158
| Variable | Purpose | Example |
148
159
| --- | --- | --- |
149
160
|`template_title`| Title of the note/to-do created using this template. | template_title: Standup - {{ date }} |
150
161
|`template_tags`| Comma separated tags to be applied to the note/to-do created using this template. | template_tags: spec, {{ project }} |
151
162
|`template_notebook`| The ID of the target notebook for this template. Whenever a new note/to-do will be created by this template, it will be created in this target notebook. | template_notebook: 82d2384b025f44588e4d3851a1237028 |
163
+
|`template_todo_alarm`| The date and time for a to-do alarm/reminder. Only applies when creating to-dos from templates. | template_todo_alarm: {{ datetime delta_days=1 format="YYYY-MM-DD HH:mm" }} |
152
164
153
165
**Points to note**
154
166
- If `template_title` is not provided, the title of the template will be used as a fallback value.
155
167
- If a tag specified in `template_tags` doesn't exist already, it will be created.
156
-
- You can't use these variable names i.e. `template_title`and `template_tags` for custom variables. In general, please avoid defining custom variables with `template_` prefix.
168
+
- You can't use these variable names i.e. `template_title`, `template_tags`, `template_notebook`, and `template_todo_alarm` for custom variables. In general, please avoid defining custom variables with `template_` prefix.
157
169
- To get the ID of a notebook, you can right click on that notebook and click on `Copy notebook ID`.
158
170
- While you are inserting the template in an existing note/to-do, `template_tags` variable is used to apply those tags to the note the template is inserted in. However, you can disable using `template_tags` while inserting templates from the plugin settings.
171
+
- The `template_todo_alarm` variable expects a date-time string in the format "YYYY-MM-DD HH:mm" (without seconds). You can use the `datetime` helper to generate properly formatted timestamps.
This note contains the meeting minutes of the weekly meet held on {{ datetime }} for {{ project }}.
173
186
```
174
187
188
+
## Advanced Template Features (Helpers)
189
+
190
+
The plugin uses [Handlebars.js](https://handlebarsjs.com/) as its templating engine, which provides powerful helpers for advanced template logic. These helpers allow you to perform comparisons, mathematical operations, text transformations, loops, and complex date/time manipulations.
191
+
192
+
> **💡 Tip:** See the [Complete Feature Demonstration Template](DEMO_TEMPLATE.md) for a comprehensive example using all helpers together in a real-world scenario.
193
+
194
+
### Compare Helper
195
+
196
+
The `compare` helper allows you to compare two values using various operators. This is useful for conditional logic in your templates.
The `repeat` helper repeats a block of content a specified number of times. Inside the block, you have access to a `repeat_index` variable (0-based).
340
+
341
+
**Syntax**: `{{#repeat count}}...{{/repeat}}`
342
+
343
+
**Example**:
344
+
```markdown
345
+
---
346
+
num_items: number
347
+
348
+
---
349
+
350
+
# Checklist
351
+
352
+
{{#repeat num_items}}
353
+
- [ ] Item {{math repeat_index "+" 1}}:
354
+
{{/repeat}}
355
+
356
+
---
357
+
358
+
# Weekly Goals
359
+
360
+
{{#repeat 7}}
361
+
## Day {{math repeat_index "+" 1}}
362
+
- Morning:
363
+
- Afternoon:
364
+
- Evening:
365
+
366
+
{{/repeat}}
367
+
```
368
+
369
+
### DateTime Helper
370
+
371
+
The `datetime` helper provides advanced date and time manipulation capabilities. It allows you to set specific dates/times, add/subtract time intervals, and format the output.
This task is due on {{datetime delta_days=days_until_due format="MMMM Do, YYYY"}}.
421
+
```
422
+
423
+
**Points to note**:
424
+
- All date/time operations start from the current date and time
425
+
- When using `set_date`, the format should match your Joplin date format settings (found in Preferences > General)
426
+
- When using `set_time`, the format should match your Joplin time format settings (typically "HH:mm" for 24-hour or "h:mm A" for 12-hour format, without seconds)
427
+
- Delta operations are applied after any set operations
428
+
- The default output format matches your Joplin date/time format settings
429
+
- For more format options, see [moment.js format documentation](https://momentjs.com/docs/#/displaying/format/)
430
+
431
+
175
432
## Default Templates
176
-
You can define the templates you use the most as default templates. Currently you can have two default templates. One for `notes` and one for `to-dos`. You can also assign keyboard shortcuts to these defaults, so that you can quickly create a new note/to-do with the respective default template.
433
+
434
+
You can define templates you use frequently as default templates, allowing you to quickly create notes and to-dos without selecting a template each time. The plugin supports both global default templates and notebook-specific default templates.
435
+
436
+
### Global Default Templates
437
+
438
+
Global default templates apply across all notebooks unless overridden by notebook-specific defaults.
439
+
440
+
**Setting global defaults:**
441
+
1. Go to `Tools` > `Templates` > `Default templates` > `Set default template`
442
+
2. Select your desired template
443
+
3. Choose the type:
444
+
-**Note**: Sets the default for notes only
445
+
-**To-do**: Sets the default for to-dos only
446
+
-**Both**: Sets the same template as default for both notes and to-dos
447
+
448
+
**Using global defaults:**
449
+
- Use the command "Create note from default template" (`Alt+Shift+N` by default)
450
+
- Use the command "Create to-do from default template" (`Alt+Shift+T` by default)
451
+
452
+
You can customize these keyboard shortcuts in Joplin's keyboard shortcut settings.
453
+
454
+
### Notebook-Specific Default Templates
455
+
456
+
Notebook-specific default templates allow you to set different default templates for different notebooks. These take precedence over global defaults when you're working in a specific notebook.
457
+
458
+
**Setting notebook-specific defaults:**
459
+
1. Go to `Tools` > `Templates` > `Default templates` > `Set default template for notebook`
460
+
2. Select the target notebook
461
+
3. Select your desired template
462
+
4. Choose the type (Note, To-do, or Both)
463
+
464
+
**Example use cases:**
465
+
-**Work notebook**: Use a professional meeting notes template by default
466
+
-**Personal notebook**: Use a daily journal template by default
467
+
-**Projects notebook**: Use a project task template by default
468
+
469
+
**Viewing all default templates:**
470
+
Go to `Tools` > `Templates` > `Default templates` > `Show default templates` to see:
471
+
- Your global default templates (for notes and to-dos)
472
+
- All notebook-specific default templates
473
+
474
+
**Clearing notebook-specific defaults:**
475
+
If you want to remove the default templates for a specific notebook (reverting to global defaults):
476
+
1. Go to `Tools` > `Templates` > `Default templates` > `Clear default templates for notebook`
477
+
2. Select the notebook
478
+
3. Confirm the action
479
+
480
+
**Precedence rules:**
481
+
When you create a note/to-do from the default template:
482
+
1. If the current notebook has a specific default template → use it
483
+
2. Otherwise → use the global default template
484
+
3. If no default is set → show an error message
485
+
177
486
178
487
## Using notebooks to store templates
179
488
The plugin also supports using notebooks to store templates instead of tags. You can start using notebooks to store your templates by going to the plugin settings and selecting `Notebook` instead of `Tag`.
0 commit comments