This code lets you apply a template when you edit a tiddler, or create a new one. The original idea belongs to @linonetwo and this code is inspired from his wonderful plugin Apply template to your new tiddler, A Template-List plugin: - Plugins - Talk TW
Also special thanks to @oeyoews for his great work on CodeMirror6 which supports applying templates. (see: [Release] Codemirror6 Plugin - #158 by oeyoews)
How it works
- Create a new tiddler
- Look at the Edit Toolbar
- Click on the Apply Template button (the pen-plus icon)
- Choose the desired template
Tutorial
Caution
- When applying a template, the content of current tiddler including the text field will be overwritten.
Code
To give a try
- Download apply-template.json (5.1 KB) and import into TiddlyWiki v5.3.6 — a non-linear personal web notebook
- Create a new tiddler
- Apply a template of choice
How to add your own template
Here are steps to create a new template:
- Create a new tiddler, (name it e.g.
$:/kookma/templates/source
) - Add meta fields and tags (these are used internally by code to work)
- tag it with
$:/tags/Template
- add field
tpl-caption
and fill it with proper short name (likeSource
) - add field
tpl-description
and fill it with proper short description (likeexternal reference
)
- Add template fields and tags
- Add all tags, your template should have
- Add all fields with initial values, your template need to have
- populate the body (text field) with heading, bullet items, initial notes, etc
As an example see below templates:
$:/kookma/templates/bookmark
$:/kookma/templates/credential
$:/kookma/templates/minutes
Credits
Ask for contribution
An area of improvement is to keep the current fields, tags, content. You may contribute and share your improved code.