-
Notifications
You must be signed in to change notification settings - Fork 269
Support for Templater Plugin #456
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
You can define custom substitutions here: https://github.com/epwalsh/obsidian.nvim/blob/main/README.md?plain=1#L372 I have some that look like this: templates = {
subdir = "templates",
date_format = "%Y-%m-%d-%a",
time_format = "%H:%M",
substitutions = {
yesterday = function()
return os.date("%Y-%m-%d", os.time() - 24 * 60 * 60)
end,
yesterday_with_weekday = function()
return os.date("%Y-%m-%d-%a", os.time() - 24 * 60 * 60)
end,
today_with_weekday = function()
... But the syntax is different than the templater plugin. |
Yes I know and I like the way this is implemented. |
I see. One workaround could be to have two versions of the same template, one for obsidian.nvim and one for the templater plugin. This is, I admit, tedious.
This is up to @epwalsh to decide. |
I'd love this feature too. The templater plugin is way cooler than the default one |
I need this feature! I like Templater and NeoVim. In Templater I use custom scripts like this: function custom_uuidv4() {
return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c =>
(c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
);
}
module.exports = custom_uuidv4; In all my templates created for Templater I use my custom function, i.e.: ---
id: <% tp.user.custom_uuidv4() %>
creation_date: <% tp.file.creation_date("YYYY-MM-DDTHH:mm:ss") %>
modification_date: <% tp.file.last_modified_date("YYYY-MM-DDTHH:mm:ss") %>
type: daily_note
tags:
- journal/daily
aliases:
--- In this example I call my custom func |
🚀 The feature, motivation and pitch
I would love to be able to use my Templater templates.
The basic template ist something like <% tp.date.now() %>.
I use it for daily notes to link between them. Which isn't possible with the default templates.
Right now I need to create the file in the Obsidian App bevor I can edit it within Neovim.
Alternatives
The custom commands are nice but I would have to setup two templates. One that runs whenever I open the file in the app and one for Neovim.
Additional context
https://github.com/SilentVoid13/Templater
This is the plugin.
The text was updated successfully, but these errors were encountered: