generated from obsidianmd/obsidian-sample-plugin
-
-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option to use regex on file path instead of folder templates
- Loading branch information
Showing
3 changed files
with
228 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,58 @@ | ||
# Settings | ||
|
||
You can set a `Template folder location` to tell [Templater](https://github.com/SilentVoid13/Templater) to only check this folder for templates. | ||
## General Settings | ||
|
||
You can set a timeout for your system commands with the `Timeout` option. A system command that takes longer than what you defined will be canceled and considered as a failure. | ||
- `Template folder location`: Files in this folder will be available as templates. | ||
- `Syntax Highlighting on Desktop` adds syntax highlighting for [Templater](https://github.com/SilentVoid13/Templater) commands in edit mode. | ||
- `Syntax Highlighting on Mobile` adds syntax highlighting for [Templater](https://github.com/SilentVoid13/Templater) commands in edit mode on mobile. Use with caution: this may break live preview on mobile platforms." | ||
- `Automatic jump to cursor` automatically triggers `tp.file.cursor` after inserting a template. You can also set a hotkey to manually trigger `tp.file.cursor`. | ||
- `Trigger Templater on new file creation`: [Templater](https://github.com/SilentVoid13/Templater) will listen for the new file creation event, and, if it matches a rule you've set, replace every command it finds in the new file's content. This makes [Templater](https://github.com/SilentVoid13/Templater) compatible with other plugins like the Daily note core plugin, Calendar plugin, Review plugin, Note refactor plugin, etc. | ||
- Make sure to set up rules under either Folder Templates or File Regex Template below. | ||
- **Warning:** This can be dangerous if you create new files with unknown / unsafe content on creation. Make sure that every new file's content is safe on creation." | ||
- `Show icon in sidebar`: Show [Templater](https://github.com/SilentVoid13/Templater) icon in sidebar ribbon, allowing you to quickly use templates anywhere. | ||
|
||
You can set [Templater](https://github.com/SilentVoid13/Templater) to be triggered on new file creation. It will listen for the new file creation event and replace every command it finds in the new file's content. | ||
## Template Hotkeys | ||
|
||
This makes Templater compatible with other plugins like the Daily note core plugin, Calendar plugin, Review plugin, Note refactor plugin, ... | ||
Template Hotkeys allows you to bind a template to a hotkey. | ||
|
||
## Security Warning | ||
## Folder Templates | ||
|
||
It can be dangerous if you create new files with unknown / unsafe content on creation. Make sure that every new file's content is safe on creation. | ||
**Note**: This setting is hidden by default. To view it first enable the `Trigger Template on new file creation` setting. And since it's mutually exclusive with File Regex Templates, enabling one will disable the other. | ||
|
||
## Folder Templates | ||
You can specify a template that will automatically be used on a selected folder and children using the `Folder Templates` functionality. The deepest match will be used, so the order of the rules is irrelevant. | ||
|
||
Add a rule for "`/`" if you need a catch-all. | ||
|
||
## File Regex Templates | ||
|
||
**Note**: This setting is hidden by default. To view it first enable the `Trigger Template on new file creation` setting. And since it's mutually exclusive with Folder Templates, enabling one will disable the other. | ||
|
||
You can specify regex declarations that a new file's path will be tested against. If a regex matches, the associated template will automatically be used. Rules are tested top-to-bottom, and the first match will be used. | ||
|
||
End with a rule for "`.*`" if you need a catch-all. | ||
|
||
Use a tool like [Regex101](https://regex101.com/) to verify your regexes. | ||
|
||
## Startup Templates | ||
|
||
Startup Templates are templates that will get executed once when Templater starts. | ||
|
||
These templates won't output anything. | ||
|
||
This can be useful to set up templates adding hooks to obsidian events for example. | ||
|
||
## User Script Functions | ||
|
||
All JavaScript files in this folder will be loaded as CommonJS modules, to import custom [user functions](./user-functions/overview.md). | ||
|
||
You can specify a template that will automatically be used on a selected folder and children using the `Folder Templates` functionality. | ||
The folder needs to be accessible from the vault. | ||
|
||
**Note**: This setting is hidden by default. To view it first enable the `Trigger Template on new file creation` setting. | ||
Check the [documentation](./user-functions/script-user-functions.md) for more information. | ||
|
||
## System Commands | ||
## User System Command Functions | ||
|
||
You can enable system commands. This allows you to create [user functions](./user-functions/overview.md) linked to system commands. | ||
Allows you to create [user functions](./user-functions/overview.md) linked to system commands. | ||
|
||
### Arbitrary system commands | ||
Check the [documentation](./user-functions/system-user-functions.md) for more information. | ||
|
||
It can be dangerous to execute arbitrary system commands from untrusted sources. Only run system commands that you understand, from trusted sources. | ||
**Warning:** It can be dangerous to execute arbitrary system commands from untrusted sources. Only run system commands that you understand, from trusted sources. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters