aptend / typing-transformer-obsidian

Improved, configurable auto formatting as typing in Obsidian
MIT License
54 stars 2 forks source link

Feature Request: Allow for insertion of templates #77

Open Tejeev opened 4 months ago

Tejeev commented 4 months ago

I'm looking for a quick way to add templates in line. Currently I copy the template into the Typing Transformer config, but it would be cool if I could just have it just insert from template so each could be edited atomically.

aptend commented 5 days ago

Could you give me some specific examples? I'm unclear about what 'templates' means; is it the core plugin Templates?

Tejeev commented 5 days ago

I think it's prudent to store the templates in the default configured template directory but basically I could add some lines of text to a file saved in the template dir then in the Typing Transformer config, specify as string which would then be replaced with the text from that file So for example, instead of:

'tgg..|' -> '---\n### ⭐: `INPUT[toggle:starred]`\n#### Open `INPUT[toggle:closed]` Closed\n#### Currently Working `INPUT[toggle:tabled]` Tabled: `INPUT[inlineSelect(option(Engineering), option(Customer), option( Me ), option(Closed), option(Someone Elses)):status]` \n#### Summary: `INPUT[textArea:summary]`\n---|'

I could instead have a file toggles in the default templates dir which contains the following:

---
### ⭐: `INPUT[toggle:starred]`
#### Open `INPUT[toggle:closed]` Closed
#### Currently Working `INPUT[toggle:tabled]` Tabled: `INPUT[inlineSelect(option(Engineering), option(Customer), option( Me ), option(Closed), option(Someone Elses)):status]`
#### Summary: `INPUT[textArea:summary]`
---

Then in the TT config, just the following line: 'tgg..|' -> toggles'|'

aptend commented 5 days ago

I've got your point. I'd prefer the syntax 'tgg..|' -f 'path/to/toggles' in which f means file, indicating the following string is a file's relative path. In addition, char | is no longer required in the path string because the cursor will be placed at the end of the inserted file content anyway.