Template Plugin

Hey @nishantwrp, here's a redacted one.

---
template_title: LOG {{#custom_datetime}}dddd{{/custom_datetime}}

X:
  label: question lorem ipsum?
  type: text
Y:
  label: question lorem ipsum?
  type: text
Z:
  label: question lorem ipsum?
  type: text
A:
  label: question lorem ipsum?
  type: text
B:
  label: question lorem ipsum?
  type: text
C:
  label: question lorem ipsum?
  type: text
D:
  label: question lorem ipsum?
  type: text
E:
  label: question lorem ipsum?
  type: text
F:
  label: question lorem ipsum?
  type: text
G:
  label: question lorem ipsum?
  type: text
H:
  label: question lorem ipsum?
  type: text
I:
  label: question lorem ipsum?
  type: text
J: 
  label: question lorem ipsum?
  type: text
K:
  label: question lorem ipsum?
  type: text
show_daily:
  label: Show daily checklist?
  type: boolean
show_weekly:
  label: HIDE saturday checklist?
  type: boolean
show_monthly:
  label: HIDE 1st of month checklist?
  type: boolean
	


---

{{#custom_datetime}}dddd{{/custom_datetime}} 

# questions
- X: {{ X }}
- Y: {{ Y }}
- Z: {{ Z }}
- A: {{ A}}
- B:  {{ B }}
- C: {{ C }}
- D: {{ D }}
- E: {{ E }}
- F:  {{ F }}
- G:  {{ G }}
- H:  {{ H }}
- I:  {{ I }}
- J: {{ J }}

# REPORT
 {{ K }}
 

# CHECKLIST
{{#if show_daily}}

<daily checklist is here>

{{/if}}

{{#unless show_weekly}}

<weekly checklist is here>

{{/unless}}

{{#unless show_monthly}}

<monthly checklist is here>

{{/unless}}


(side note, would be cool to be able to set a boolean as false to start, you can see I use a double negative to make it work :slight_smile: )

2 Likes

Release v2.2.1 :rocket:

Bug Fixes

  • #55: handle empty tags in special variables (2aec687), closes #55
  • set a max height for variables form (0aa28b4)

For reporting bugs/feature-requests or to know more about the plugin visit the GitHub Repo.

3 Likes

Hi,

I received a message from a user showing interest in supporting the development of the plugin through donations. So, I've added a supporting section in the plugin readme -> GitHub - joplin/plugin-templates: Create templates in Joplin and use them to create new notes and todos..

Thanks!

3 Likes

Release v2.3.0 :rocket:

Features

  • allow using notebook for storing templates (#63) (fd8c40c), closes #62

Bug Fixes

  • do not bundle .env with npm package (51cc799)

For reporting bugs/feature-requests or to know more about the plugin visit the GitHub Repo.

5 Likes

Hi @nishantwrp

I will find it very useful to be able to add to a reminder/due date in a template. Especially for quick tasks to do for the next day (e.g.). Do you think it would be possible ?

There's already an issue for this feature. Actually, I haven't had time to research on feasibility of this feature. PRs are most welcome!

1 Like

Hi nishantwrp

Thank you for this plugin and especially for still maintaining it.
Something I would find very useful is if the input window would set the focus into the first field.

enter a title

In the end it is only one click, though I got used to directly start typing in other plugins.

Something else is that if I use an apostrophe in this input field it appears as unicode ' in the markdown file. I just discovered on the handlebar.js site that with {{{ }}} you can prevent this escape. Maybe this would be something to mention in your readme?

1 Like

Release v2.4.0 :rocket:

Features

  • #68: format date and time variables according to user preferences (581a1da), closes #68
  • add license (a63591c)
5 Likes

Thanks for creating this plugin. I'm currently using it to manage my ChatGPT prompts. That is awesome.

That's interesting, would love to know more about your use case with ChatGPT @benlau.

For example, the most common prompt I use with ChatGPT is a grammar corrector. I also want it to rewrite the tone according to the situation. Therefore, I have the following template.

---
tone: dropdown(causal, professional, conversational, humorous, empathic, academic)
template_title: Prompt: {{date}} Fix grammar

---

I want you to act as a grammar mistake checker and make the sentence more fluent. 
You take all the user input and auto correct it. Just reply to user input with correct grammar, DO NOT reply the context of the question of the user input. Use a {{ tone }} voice and tone. 

Each time I need to fix grammar in a written text, I simply use the "insert template" feature and choose the desired tone. And then c&p to ChatGPT.

I also have a long prompt with 14xx tokens. It instructs ChatGPT on how to convert my notes into a mermaid graph using the Few Shots Prompting technique. However, I haven't stored it in Joplin yet because I need to choose the examples for few shot prompting. It would be helpful if Template Plugin could support "translude".

3 Likes

Can you give an example. It would be a lot better if you could create an GitHub Issue for it. It is lot easier for me to track there.

1 Like

Btw, glad to hear about how you're using this plugin.

I'm also interested in that. I could definitely use some transclusions in joplin, but I don't quite see why that should be a part of the template plugin.

(also for @zblesk)

I know of 2 ways you can transclude in Joplin, if I got your intention right: using Embed Search (works only in the markdown preview panel) and using Note Overview (which directly edits the note). None of them is as well integrated as transclusion in recent-generation note-taking apps, but they're useful.

Here's an example of a template (based on @benlau's) that transcludes a note using its ID. I used Embed Search because I ran into parsing issues with the parsing of the Note Overview yaml.

---
tone: dropdown(causal, professional, conversational, humorous, empathic, academic)
template_title: Prompt: {{date}} Fix grammar
note_id: text

---

I want you to act as a grammar mistake checker and make the sentence more fluent. 
You take all the user input and auto correct it. Just reply to user input with correct grammar, DO NOT reply the context of the question of the user input. Use a {{ tone }} voice and tone.

```search
content:true
id: {{note_id}}

(remember to end this with ```)

As a side note (and in case anyone finds a way to use this in templates), here is how to transclude with Note Overview. The issue was that the wildcards {{excerpt}} and {{title}} are picked up by the template plugin, which renders them as empty strings in the generated note, but they are needed in order for Note Overview to work. Perhaps @nishantwrp will know how to make it work. It's probably also possible to create a mini-template for transclusion using the Slash Commands plugin (based on either of the transclusion methods) and combine this approach with the template plugin.

<!-- note-overview-plugin
search: "id: {{note_id}}"
fields: excerpt
excerpt:
  maxlength: 1000000
  removenewline: false
  removemd: false
listview:
  text: |-
    # {{title}}
    {{excerpt}}
-->

Clearly, you've thought about this as well. :grin:
I pretty much agree. "Embed Search" is close, but I'm not using it much; sometimes I'd just like to be able to transclude a specific section of a note, not the entire thing.
And even though I use Note overview regularly, it's not good for this specific use-case, because it directly edits the note. That is great when it's used to compile lists, etc; but in this case you'd get many unnecessary/spurious hits in search, instead of just the one that actually matters.

(Also, it'd be great to have backlinks - i.e. each note should see which notes are referencing it in a transclusion.)

:slight_smile: Yeah, it could be nice to have a dedicated, flexible transclusion plugin that fully implements these features.

What I do like about note editing, is that it's future-proof and cross-platform.

There is a 3rd way to kind-of-transclude that I didn't mention earlier, via the Note Link System plugin. The plugin can display previews of outgoing links from the note within the Markdown viewer, and in the case of internal links - even to specific sections in notes - the pop-up shows the content of the relevant section. Since every link creates an automatic backlink (via the NLS plugin, or other supported plugins), you get also that feature.

I don't use the view panel often, so it's not highly relevant for me, but it's an added bonus to using the plugin. Every link has its "transclusion".

@nishantwrp just a ping/reminder to say that the PR for better logical comparisons has been done and ready to merge for a couple of months now

yes, sorry am not getting the time to review it. will do it soon.

1 Like

Very interesting plugin thanks for developing it!

I wonder whether it would be possible to define a template inside the note (i.e. not in the separate templates space, but exactly in the note where I use the template)?

Let me provide an example.
I am going to use Joplin for planning social posts, and created for each day a separate note with the following structure:

Image:
Hashtags:

## LinkedIn

## Facebook
 
## Twitter

As you could imagine, the Hashtags will be the same for each social network, and I would need to define at the beginning of the file exactly as you already implemented in the template definition

---
LocalHashtags: #cool #beautiful #useful

---

and than just put {{ LocalHashtags }} in several places where I need it.
The solution you already implemented (i.e. having separate template) does not fit this purpose because hashtags will be different for each post, and it would be a challenge to keep them ordered in a single template.

Please could you let me know whether the extension of your plugin to the availability of definition of template at the beginning of the current note is possible?

Thanks in advance!