Comments (2)
Have you tried using the tp.hooks.on_all_templates_executed hook? Also I would consider a different way of getting the current file. Would look something like this.
tp.hooks.on_all_templates_executed(async () => {
var file = tp.file.find_tfile(tp.file.path(true));
// var file = app.workspace.getActiveFile();
await app.vault.modify(file, "");
});
What kind of hook would you be looking for? I'm not sure what this template is trying to accomplish.
from templater.
I have a shortcut on my android that when I click it it opens Obsidian and creates a file called Untitled in a specific folder.
Templater adds a property and textToday to the file
Templater renames the file from Untitled to current date.
If Templater sees that the file with the current date exists (maybe there were two created in the same minute), then it adds a dash at the end. This is attempted 10 times.
Once that's complete, I can start writing in the file.
Sometimes I want to spin off different files from that one. For example I may write [[Koenar]], and press on it.
Templater does its usual activities of writing textToday.
However, it does not need to, and I also don't need to change the file name, it's already correct - Koenar.
From there I just move the file (I have a shortcut CTRL+M, or a button above the keyboard on Android).
Some callbacks for deciding what name the file should have, with conditions, would be nice.
Also some callback to decide if templater should run for the file, or it should just leave the file blank.
I will give that hook a try, I had some issues with it yesterday..
from templater.
Related Issues (20)
- Embedded image causes Obsidian to lock up for 45 seconds in renderer HOT 1
- Link to a new file will trigger Templater in a specific folder HOT 2
- Feature request: allow for ordering which templater code is excuted first HOT 2
- Templater updates new file's last modified timestamp even if no templater code was run
- SImple syntax not displaying values correctly HOT 2
- Suggestion to Improve New Folder Template Addition Behavior in Templater Settings HOT 1
- Bug | tp.date.now() will incorrectly parse the last week of the year and first week of the next year HOT 2
- Random picture generator inoperable HOT 15
- First character of file path cut off in command palette if no templates folder set HOT 8
- Minify main.js HOT 1
- Add support for vanilla template variables like {{data}} for enhanced compatibility
- Using tp.file.rename doesn't rename current note but creates a new note instead HOT 1
- System Prompt in file order HOT 3
- First letter of every file cut off in search modal HOT 1
- template mis-applied when a note is created but not opened HOT 1
- generate_folder() has incorrect `relative` logic vs generate_path() HOT 1
- Syntax highlight on desktop causes the leading part of unordered list in table cell to disappear HOT 1
- Request: Zipped release for manual install
- Duplication bug when using Multiple Cursors
- Templater web requests not working on Obsidian mobile HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from templater.