Code Monkey home page Code Monkey logo

templater's Introduction

Hi there ~ hi

This is the place where I share what I build and break, where I have fun.

⚡️ My open-source projects

  • Obsidian
  • Infosec
  • Algorithmic
    • telos - Implementation of common algorithms and data structures
    • aoc2022 - Advent Of Code 2022, in Rust
    • aoc2023 - Advent Of Code 2023, in Rust
  • Tools
    • sov - Text-editor agnostic tool for personal knowledge management
    • SyncDisBoi - Music streaming platforms (Youtube Music, Spotify) synchronization tool
    • critique.rs - Collection of tools for SensCritique
    • McqConverter - Multiple choice questions format conversion tool (AMC, GIFT)
  • System Configuration
  • Misc
⚡️ Very useless stats

templater's People

Contributors

ab1908 avatar andrewmcgivery avatar ankushg avatar ash-zzz avatar bartn avatar chrisgrieser avatar dependabot[bot] avatar iamrecursion avatar ilandikov avatar jeppeklitgaard avatar kepano avatar liamcain avatar maroux avatar pjkaufman avatar pyjamads avatar rhhub avatar sawft99 avatar seatrout avatar shabegom avatar shyamgadde avatar silentdot avatar silentvoid13 avatar swfz avatar tfthacker avatar tomhall2020 avatar welpdx avatar weph avatar wernersa avatar zachatoo avatar zsviczian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

templater's Issues

{{tp_date}} doesn't work for a few days now

Plugin informations (please complete the following information):

  • OS: Windows 10
  • Templater version: 0.5.7
  • Obsidian version: 0.10.7
  • Templater settings:
    image

Describe the bug
The {{tp_date}} command isn't doing what it's supposed to. It just days as is. Screenshot Attached.

Expected behavior
The date should print.

Screenshots
image

Keyboard input stops working after inserting template (Obsidian 0.9.16

  • OS: macOS Catalina
  • Templater version: 0.4.2
  • Obsidian version: 0.9.16

Describe the bug
In the latest Obsidian version, the keyboard input stops working after inserting a template. Clicking outside of the text area re-enables the input.

Expected behavior
Templater should no longer manually put the cursor back in the text area and let Obsidian handle it.

Additional context
This is probably because of the improvement in this version: "- Command palette and Quick switcher will now restore your cursor or selection when exiting."

Today note integration does not apply template

Plugin informations (please complete the following information):

  • OS: macOs 10.15.5 (19F101)
  • Templater version: 0.5.3
  • Obsidian version: 0.9.22

Describe the bug

For the daily note plugin, I've configured a template which uses shortcodes from the Templater plugin. When applying this template in any note, it works fine. When the daily note plugin creates a new note, the template is only applied as plain text, the shortcodes are not replaced with the values.

Expected behavior

When the daily notes plugin creates a new file, I expect the template to be applied in a way that the shortcodes are replaced with the values.

Additional context

I tried the same with the Obsidian core plugin, but behaviour there is the same.

Allow using arguments with user templates

It would be nice to be able to use arguments with user templates.

For example, I tried to create a user template called {{test}}, which just echoes some text.

If I run it as-is (without arguments), it works fine.

But, I would like to use it like this: {{test:arg1="arg1 value"}}

Templater could define the given arguments as environment variables, before running the template command.

So, the template command could be something like: echo "Test: $arg1"

When run, the example command would become: Test: arg1 value

Templater corrupts pasted .pngs

Plugin informations (please complete the following information):

  • OS: osx 10.0.1
  • Templater version: [e.g. 0.5.3]
  • Obsidian version: [e.g. 0.10.1]
  • Templater settings: default

Describe the bug
Take a screenshot and paste it: (cmd-ctrl-shift-4)(cmd-v).
Image file is corrupted if the templater is on.

Expected behavior
The image file should not be corrupted.

Screenshots
image

Additional context
Turned off all other plugins, this one is it. No idea what it does to the files, I'll attach one here:
Pasted image 20201220200438

Single template automatic select

When there is just one template in the templates folder, it shouldn't me choose it in the menu, but just insert it at once. That's how the core plugin works.

Is there a way to select a different python version?

I have written a script to pull my teaching timetable and put it into a template. Everything works fine from terminal. When I add it to Templater, it reports "module requests not found". Upon investigation I discovered that it always selects the system python regardless of the command I run. I even tried embedding the call in a bash script to no avail.

Any suggestions would be greatly appreciated

Perhaps a Documentation Error

the plugin-document says that {{tp_date}} will return today’s date, but I can only get today’s date using {{tp_today}}, as is shown in the demo-gif…

Templates for multiple OSs

Is your feature request related to a problem? Please describe.

For any given template I can only provide a single command. This means writing a template which works on two operating systems (primarily when one of them is Windows) is tricky or possibly impossible.

Describe the solution you'd like

This could be solved by allowing the user to provide multiple commands for a template, depending on the operating system.

At execution time, there are a couple options:

  • Check window.navigator.platform and run the correct command.
  • Attempt to detect the OS by running commands known to work only on one OS (perhaps (gwmi win32_operatingsystem).Version on Windows, sw_vers -productVersion on OSX, etc)
  • Just run the template command sequentially until one returns with a success code.

Describe alternatives you've considered

Not using Templater 😭

tp_include doesn't recursively execute user-defined templates

Plugin informations (please complete the following information):

  • OS: OSX, most recent
  • Templater version: 0.5.5
  • Obsidian version: 0.10.7
  • Templater settings: /assets/templates/, timeout 5

Describe the bug
When using the new {{tp_include}} (amazing btw!) functionality, it correctly recursively executes the built in {{tp_*}} templates, but not user defined ones, like weather

Expected behavior
I would expect the templater to recursively execute both built in and user defined templates

Screenshots
Screen Shot 2021-01-08 at 15 57 36

Screen Shot 2021-01-08 at 15 57 42

Screen Shot 2021-01-08 at 15 57 53

IT just stopped working today

Plugin informations (please complete the following information):

  • OS: OSX Catalina
  • Templater version: 0.4.4
  • Obsidian version: 0.9.21
  • Templater settings:
    image

(My template dir gets blown away each time I upgrade btw)
Describe the bug
I try to add a template I have that looks like this:

---
tags: #daily-log
---
<<[[{{tp_yesterday}}]]::[[{{tp_tomorrow}}]]

tags:#daily-log

# {{tp_today}}

which would always work but now nothing happens
Expected behavior
I should get a templated note

Screenshots
image
image

Header gets indented when template inserts

Plugin informations (please complete the following information):

  • OS: macOS 10.15.7
  • Templater version: 0.4.2
  • Obsidian version: 0.9.15
  • Templater settings: template Folder Template, Timeout 5, Custom Command:
{{now}}
date +"%Y-%m-%dT%H:%M"

Describe the bug
When I insert a template inside a header, it gets indented (see gif)

Expected behavior
Indentation should stay the same.

Screenshots
Kapture 2020-11-25 at 9 28 21

Custom Template for Date

I was trying to create a tempplate to print a note n days from now using the example you had shared in the readme.
I tried to modify it by a bit. The command I used was

powershell (Get-Date -UFormat '[[%Y-%m-%d | %A, %d %b]]' (Get-Date).addDays(1))

It works fine in the Powershell, but throws an error in Obsidian.
image

Upon more digging, I found that the | in the format is the cause of error. What should I do to get it right? I tried \|, but didn't work.

Templater doesn't insert templates in latest insider version

Getting crashes, and also no inserted template on the latest Obsidian insider release.

  • OS: MacOS Catalina
  • Templater version: 0.4.4
  • Obsidian version: 0.9.20
  • Templater settings: [e.g. Template folder location: "Templates/", Timeout: "5" (add the templates not working with their associated command)]

Describe the bug
When inserting any template (also ones that don't use any internal template), nothing happens and i get a TypeError:

Uncaught (in promise) TypeError: Cannot read property 'workspace' of null
    at CustomPluginTemplates.<anonymous> (app.js:1)
    at app.js:1
    at Object.next (app.js:1)
    at app.js:1
    at new Promise (<anonymous>)
    at a (app.js:1)
    at CustomPluginTemplates.e.insertTemplate (app.js:1)
    at CustomModalTemplates.t.onChooseItem (app.js:1)
    at CustomModalTemplates.t.onChooseSuggestion (app.js:1)
    at CustomModalTemplates.t.selectSuggestion (app.js:1)

I cannot make User Templates work?

I defined:
User Template: {{my_today}} with value: date +"%Y%m%d"
I created a Template in my ZZ_Templates folder (configured in Templater):
# {{my_today}} {{templater_file}}

When trying to use the template, I get: Error with the template n1: check console for more informations.
Output in an empty file called "Test":
# {{my_today}} Test

Why?

Question marks about {{tp_title_date}}

After reading and following some parts of the readme.md, I formatted my daily note template accordingly to get this:
{{tp_title_date:title_f="YYYY-MM-DD, ddd",f="MMMM D, YYYY; dddd"}}
From "2021-01-16, Sat" to "January 16, 2021; Saturday"

Is that the right format for the template or am I missing something?

I've tested this by creating future and past daily notes using the Calendar and Review plugins, plus used Templater to manually paste the template onto different daily notes… and the results are pretty confusing.

I would get the Error with Internal Template notification whenever I created a daily note using the Calendar plugin. I followed the notification and checked the console, which only told me about using the 'title_f' argument, so I might be using the argument wrong??

Using the Review plugin to create a daily note did not give the error, but the template showed today's date instead of the daily note's corresponding date.

And yet, when using Templater to paste the template, it works just fine. Tried this with a particular date a few months from now, yesterday and tomorrow's dates. It seems to work just fine when I manually add it to any daily note, so why not with other methods??

Hoping you'd help me with this "question" of mine. Was about to report it as a bug but I might embarrass myself if it turned out the problem was with the formatting of the arguments 😨 Much thanks and great work with the plugin!!

User templates not working?

I defined:
User Template: {{my_today}} with value: date +"%Y%m%d"
I created a Template in my ZZ_Templates folder (configured in Templater):
# {{my_today}} {{templater_file}}

When trying to use the template, I get: Error with the template n1: check console for more informations.
Output in an empty file called "Test":
# {{my_today}} Test

Why?

Replacing custom locales with obsidian window.moment

For now, the obsidian window.moment variable supports locales but does not set them by default to the obsidian app language.
When they will, I'll be able to remove Templater custom locales implementation along with the moment.js dependencies to make the plugin lighter.

dddd formatting after comma doesn't translate

Pretty sure that OS is irrelevant here.

  • OS: Ubuntu LTS 20
  • Templater version: 0.5.7
  • Obsidian version: 0.10.9

dddd formatting doesn't translate after comma

The use of the following format tp_date:f=Do MMMM YYYY, dddd produces "1st January 2021" and not "1st January 2021, Monday"

ddddd does not get resolved; Square brackets also don't work.

Leaving out the comma as such tp_date:f=Do MMMM YYYY dddd works.

Overload Obsidian template plug-in

  1. When using the DailyNotes plug-in the Overload works as expected. However with the internal template plugin or external plugins like the Calender the Overload is not triggered. This results in all Templater templates not being replaced.
  2. When using Alt+E all {{date}} {{time}} are not being replaced without specifying user defined templates.

It would be nice to have a general Overload triggered for all of this plugins. Or at least support all the native templates of the Obsidian templates like {{date}} {{time}} so the plug-in can replace the internal template creation while using the same syntax.

I know that {{tp_today}} can replace the functions however it makes basic templates not usable in the Templater workflow.
For now I was helping myself by adding custom commands for {{date}} {{time}} but I think it could be good to have this implemented for everyone. Especially as this workaround can not serve all formats like {{time:HH:mm}} to my knowledge.

Sorry if I missed something out. Just started using Obsidian 👍

Issue accuring on Windows 10 using
Obsidain 0.9.15
Templater 0.4.2

Minor code issue

this.settings = (await this.loadData()) || new TemplaterSettings();

I've seen another plugin do this and asking around they seemed to have followed the code in Templater.

Here, I recommend you to use an interface instead of a class for your settings - loadData returns the result of a JSON.parse() which is a plain object.

Run a bash script

Hi,

I try to run a bash script "with templater" but i can’t find why i have an error :

The script is very simple and work in the terminal

#!/usr/bin/env bash

R -e "rmarkdown::render('/home/manu/Téléchargements/test.rmd', 'word_document')"

My templater looks like this

image

Any idea ?

Ideas to improve extensibility

Hi, very cool plugin. I jotted down some ideas after playing with it for a bit. Let me know what you think!

Ideas

  • In addition to having people submit internal templates to this repo, I think it would be nice if this plugin would just look for javascript files that I could add from my local. So there could be a template dir and a tags dir.
    • This could be a lot more flexible than the bash commands. (While I could achieve the same effect by adding bash commands to call js scripts, that seems like a lot of misdirection)
  • Any reason why you prefixed mustache tags with templater_? Is that just to avoid clashing with user defined tags?
  • I think it would be nice to allow passing args within the replace string, similar to how the built-in templates work. Here's the un-minified version of how Obsidian handles date/time: https://github.com/liamcain/obsidian-calendar-plugin/blob/master/src/template.ts. Each tag could get passed the additional args and choose how to handle them.

Small Nit

  • internal_templates_map probably doesn't need to include the {{mustaches}}, you could just add them in the replacer function.

Internal Command Template: fully qualified filename of current note

Is your feature request related to a problem? Please describe.
I have some use cases where a script would need to know where the file is actually located in the file system.
The {{note_title}} template only passes the name of the current note to an external command.

Describe the solution you'd like
A command template like {{note_fullpath} that is the fully qualified name of the current note file, (e.g. /Users/guy/ownCloud/Notes/2015-07-30T0719 - Buffer.md)

Describe alternatives you've considered
I have not found any alternative solutions

Thanks,
Guy

Allow including template files in other template files

I'd like to "include" a template file within another template file.

For example, I have a YAML frontmatter template:

---
aliases: []
tags: []
cssclass: []
---

I also have a zettel template, which is currently just:

# [[{{title_without_zettel_id}}]]

({{title_without_zettel_id}} takes in the filename and strips the Zettel ID from the beginning)


Currently, if I want to have the YAML frontmatter in my Zettel template, I have 2 (bad) options:

  1. copy the contents of the frontmatter template into all of other templates where I want to use it
    • if I ever need to change the YAML frontmatter (Obsidian adds a new feature, etc.), I would need to remember to update all of my template files (instead of just the frontmatter template file)
  2. I need to run Templater twice
    • first for frontmatter, then for zettel

I'd like to include the frontmatter template inside the zettel template, with something like:

{{include:template=frontmatter}}

# [[{{title_without_zettel_id}}]]

This way, both of the above issues would be solved cleanly.

Of course, when including files like this, cyclic includes would need to be handled (if zettel includes frontmatter, but frontmatter also includes zettel). These can be fixed by either:

  • a simple maximum recursion depth (more than e.g. 10 recursive includes would give an error, pretty foolproof)
  • keeping a list of all included files, and checking that a newly included file isn't already in the list ("proper" way to do the check).

I could achieve something similar with a {{frontmatter}} user template, but then I wouldn't be able to use any of my existing templates inside of that template (again, I would have to replicate a lot of the same behavior in multiple places).

Please let me know if I'm missing something, and this is already possible. 😛

Set cursor location

Is your feature request related to a problem? Please describe.

Is there a way that we can control the end position of the cursor when a new file is created?

A workaround is to create an empty command, for example: {{cursor}} mapping to echo

image

Then use a template like:

📆 [[{{tp_yesterday}}]] – [[{{tp_tomorrow}}]]

# {{cursor}}

image

Describe the solution you'd like

The workaround breaks if you want the cursor to be in the middle of a file – e.g., templated content above and below the end cursor location.

Describe alternatives you've considered

The workaround above would be okay if you could control the execution order of the templating commands. A simpler solution might be to have a {{tp_cursor}} command that is guaranteed to run last?

Doesn't work well with Daily Note / Calendar

I am using Templater for Obsidian 0.9.22, windows x64.

Whenever I use templater by shortcut or command like, it works like charm. But when I create a daily note, there it should automatically generate things, but rather it just has the 'source text' with very little or no conversions. WHhile if I remove the text and insert template via command or hotkey, the text is correctly populated.

Plugin no longer working, exception caught in developer console

Plugin informations (please complete the following information):

  • OS: macOS 10.15.7
  • Templater version: 0.4.4
  • Obsidian version: 0.9.22
  • Templater settings:

Obsidian v0 9 22 - Wiki 2020-12-08 at 13 19 34

Describe the bug

I'm not exactly sure what is causing this, but the plugin is no longer working; templates no longer expand when I invoke the Templater command. When it's invoked, in the developer console I see this:

Uncaught (in promise) TypeError: Cannot read property 'workspace' of null
    at CustomPluginTemplates.<anonymous> (app.js:1)
    at app.js:1
    at Object.next (app.js:1)
    at app.js:1
    at new Promise (<anonymous>)
    at a (app.js:1)
    at CustomPluginTemplates.e.insertTemplate (app.js:1)
    at CustomModalTemplates.t.onChooseItem (app.js:1)
    at CustomModalTemplates.t.onChooseSuggestion (app.js:1)
    at CustomModalTemplates.t.selectSuggestion (app.js:1)

Here are the plugins I currently have installed (they're all up to date as of right this second, I wish there was an easier way to export the current list of plugins):

image

I can verify that "regular" templates expand when I use the built-in OBsidian functionality.

Expected behavior
Templates expand properly

Internal template idea

From user nadav on Discord, an internal template like {{tp_title_today}} where we can set a configurable offset for the day, e.g. 7 days ago, in 14 days, ...
I think the name {{tp_title_date}} will be good.

Nested User Templates

Is your feature request related to a problem? Please describe.
I would like the ability to add Internal Templates and User Templates inside of other User Templates. This is specifically for the system command calls. So having something like: date -j -f "%Y-%m-%d_%a" "{{tp_title}}" +"%A, %d %B %Y" as a user template extends usage of the {{tp_title}} template and feeds it through a date converter.

Specifically, I'd like to be able to create back-dated daily notes (through the Calendar) without the interference of having to mess with multiple templates or manual interaction of having to fix links and titles.

Describe the solution you'd like
I'd like the Templater to execute the Internal Templates first, then execute the User Templates. If it comes across a {{X}} in the User Templates for the system commands, check and see if a template matches {{X}} and fill in the appropriate details before passing as a system command.

Click Tab to move from {{tp_cursor1}} to {{tp_cursor2}} to.....{{tp_cursorN}}

Is your feature request related to a problem? Please describe.
When I used template to generate stuff, I should use my mouse to click one by one to type different stuff.

Describe the solution you'd like
I found now the plugin do support {{tp_cursor}}: This will set the cursor to this location after the template has been inserted.
So I do not know if it is possible to add PLUS support to make {{tp_cursor}} allow people to move from one by one.

A possible solution:

continuous template inserting by click a hotkey to insert a template then trigger to insert another template

For example:

When I want design a template with more than one {{tp_cursor}}, after I insert the template to note by clicking Enter, and then, I click another hotkey, it will check if there are others {{tp_cursor}} and then plugin moves cursor to next {{tp_cursor}} until there is no {{tp_cursor}} in the note.

Example commands not working

Thanks for the work!

I tried to replicate the original example:
My template [Template] Daily in my 999 Templater\ folder
`Note type: #daily-note


<< [[{{yesterday}}]] | [[{{tomorrow}}]] >>

{{weather}}

Daily quote:
{{templater_daily_quote}}

{{today}}

Resources

Thoughts

Day Planner

`

As pictured here:
image

These are my user defined functions:
image

And this is my 'view' output when creating a new template:

image

As similarly reported, it says I get an error on the console. But I am not able to find a console / log file. I've asked on the discord channel, waiting to hear back.

I'm running windows 10.

Doesn't look in specified Template folder location

Thanks for a great extension! Unfortunately, I can't get it to look at a specific folder for templates.

What I did:

  • I have a folder named Templates at the root of my vault.
  • I have a Daily template in there.
  • I have configured Template folder location to Templates

Expected result: When I choose "Templater: Insert Template", only notes in Template should appear.

Actual result: It appears to be looking everywhere:

Screenshot from 2020-11-08 14-14-59

More specifically, it appears to be looking at all the files in the root directory (not only .md files), and then it looks into my last subdirectory (zk).

What I also tried: I tried changing the "Template folder location" to Templates/, but then the plugin complains that such a folder doesn't exist.

{{ }} not required in template document?

When I include the parentheses {{ }} around a template name in the template document, the filled-in template still contains the {{ }} but with the actual value of the template inside, e.g.

{{tp_today}} becomes {{2020-11-06}}

If I instead just put tp_today in the template document, not wrapped in curly braces, this works fine and renders as 2020-11-06.

This also happens for user-defined templates.

Unsure if this is the intended behaviour? I'm running Windows 10 with Templater 0.4.2 and Obsidian 0.9.15
Thanks!

Today note integration overwrites existing note

I've been working out a time blocked day plan the night before on my next day's today note. When using Templater, this note gets overwritten. Would it be possible to prepend the template before the note content if it exists?

Put writing cursor at the end of the template after insertion

Right now, after inserting a template, the editing screen seems to lose focus, and you have to click on it to continue editing. Ideally, the cursor would be active (focused) on the position just after the inserted template (I think this is what the built-in template plugin does as well)

Weather on windows

Under windows 10, using 0.9.15 of obsidian and vr 0.4.2 of templater.
The new suggested powershell command to obtain weather does not work.

But the other powershell commands do work.

As a work around, the Linux curl command works anyway ;)
works == curl "wttr.in/Sydney?format=%l:+%C+%t+%p+%w+%h"
doesn't work == powershell ((Invoke-WebRequest -Uri wttr.in/Campsie?format=3).Content)

image

NB: the format setting doesn't seem to impact the outcome.

Feature Request: Trigger Templater template fields when using Daily Note feature

Summary

It would be super helpful to somehow have Templater fields trigger when running the Daily Note plugin, so the fields translate into data, as opposed to separately triggering the Templater templates after opening a blank Daily Note.

Steps to reproduce

  1. I added Templater fields to my Daily Note template;
  2. When I create a Daily Note using the Daily Note plugin, the Templater placeholders don't render as expected;
  3. If I trigger the Templater template specifically, it renders.

What I did

This is what I added to my template:

Tags: #dailynote

{{weather}}

# {{today}}

Here are my templates:

Screen Shot 2020-11-16 at 8 21 20

Here is a demo of what happens: https://d.pr/v/kJ4FuD/sY2w43DZXe

System details

Obsidian v0.9.11
OS: macOS 11.0.1

Allow using internal templates within command templates

Internal templates, in particular {{templater_title}}, would be very useful when defining template commands.

For instance, it would allow manipulating the date in the title of a daily note that is not for the current day, through eg date -jf "%d-%m-%Y" -v+1d "{{templater_title}}" +"%d-%m-%Y" (gets the day after the day denoted in the title).

Or for example escaping the spaces in the title with %20 (input="{{templater_title}}"; echo ${input// /%20}), which allows templating search queries like https://scholar.google.nl/scholar?&q={{title_url}}

can a template action be based on the "current selection" in the editor?

Not sure if I am even asking this in the right way, but here's my use case:

I'd like to create a template that uses the current selected word or phrase as a parameter for the template. One example could be a "turn selection into linked Google search":

  1. hightlight a word e.g. "Zettel"
  2. activate Templater, with template containing something like:
[{{tp_selection}}](https://www.google.com/search?q={{tp_selection:urlencoded=true}})
  1. have that selection replaced with [Zettel](https://www.google.com/search?q=Zettel)

Is this possible today or somehow in the future?

Is Dynamic Template selection possible?

I'm not great with Regex or command line.

Was wondering if it would be possible in theory with current capabilites of the plugin to create a single template that dynamically selects an appropriate template based on the content of the Note Title.

For example, if the note title contain the word "Note" it would use the Note template in the template folder. If it contains "Journal" it would use the Journal template.

Just thinking that this would have great synergy with Note Refactor plugin that allows you to use Templater macros but only has space for one template. A dynamic template would make a lot of note making workflows smoother.

Would love if someone could share some speculative code that I can try to apply.

similar to {{note_title}} and {{note_content}} can we have {{note_path}}

hello,

{{note_title}} is helpful for passing the current daily note to an external program (pwsh) for processing.

however, when not dealing with daily notes it can be tricky if your vault contains files with the same name, but in different directories.

i haven't had success on Windows 10 while passing {{note_content}} to pwsh when the note contains newlines.

is there some way we can pass the path of the note to the external program when using a user configured template?

this example works with notes that do not contain newlines, but not ones that do
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.