Purpose of the Obsidian Plugin: Templater
Templater is a plugin for Obsidian.md that allows users to create and manage templates to enhance note-taking workflows. It introduces a templating language within Obsidian, enabling users to insert variables, execute functions, and run JavaScript code directly within their notes. Some key features include:
- Dynamic templating: Insert variables like the current date or time and execute advanced logic using JavaScript.
- Custom workflows: Automate note creation and management, including creating new files, moving files, or adding metadata.
- JavaScript execution: Users can embed JavaScript scripts within templates to perform custom operations.
- Advanced template management: Supports folder-specific templates, file regex templates, and integration with external APIs.
Warning: As it supports running arbitrary JavaScript and system commands, users are advised to use it cautiously, especially when importing templates from untrusted sources.
Evolution of Templater
Templater has undergone significant development since its inception. Below is an overview of its evolution:
Major Features Added Over Time
-
Template Functionality Enhancements:
- Support for string-based folder arguments (
tp.file.create_new()).
- Ability to handle non-markdown file extensions in templates.
- Dynamic functions like
tp.web.request for making HTTP requests.
-
Improved Autocompletion:
- Recent versions (2.9.0+) introduced
tp.app modules for better autocompletions, making the plugin more user-friendly for scripting.
- Autocompletion now ignores case sensitivity for smoother usability.
-
Performance Improvements:
- Minification of production builds to reduce plugin loading times (introduced in version 2.6.0).
- Limiting results for file/folder suggesters to improve performance when handling large datasets.
-
Bug Fixes:
- Addressed various edge cases, including:
- Fixes for template content being overridden during file operations.
- Better handling of folder-specific templates to avoid unexpected behavior.
- Resolved issues with mobile UX, including autofocus in prompt inputs and template commands for the mobile toolbar.
-
API Integrations:
- Integration with external APIs like Unsplash for dynamic content (e.g., fetching random images).
-
Backward Compatibility:
- Continuous updates to match newer versions of Obsidian, ensuring compatibility with its evolving architecture.
Recent Developments (v2.8.x and v2.9.x)
-
Version 2.9.1 (October 30, 2024):
- Fixed compatibility issues for
isMobileApp checks by switching to isMobile.
- Dynamically required Node core packages to prevent failures when emulating mobile environments on desktops.
-
Version 2.9.0 (October 22, 2024):
- Introduced
tp.app module for autocompletions.
- Improved UX by ignoring case sensitivity for autocompletions.
-
Version 2.8.3 (October 18, 2024):
- Updated the plugin to import
moment from Obsidian instead of relying on window.moment.
- Fixed issues with fetching daily quotes by switching to a new quotes API.
Controversial Issues and Pull Requests
Several issues and changes have been debated within the Templater community. Some noteworthy examples include:
-
Security Concerns:
- Execution of Arbitrary JavaScript: As the plugin allows running arbitrary JavaScript and system commands, there have been concerns about security risks, especially when importing templates from untrusted sources. This issue is highlighted in the README, but it remains a point of contention among users.
- Pull Request Impact: There hasn’t been a direct PR addressing this, but the plugin's maintainers emphasize user caution in documentation.
-
Hotkey Changes (Breaking Change in v2.8.0):
- The introduction of an "Insert Hotkey Setting" in version 2.8.0 (PR: #1475) caused hotkeys to be reset, creating frustration among users. This required users to reconfigure their hotkeys, leading to complaints about breaking changes in minor updates.
-
Mobile Compatibility Issues:
- Several mobile-specific bugs were noted, such as difficulties with autofocus and hotkeys on mobile toolbars. These were resolved in versions like 2.9.1 and 2.7.x, but the initial lack of mobile support drew criticism.
-
Folder Template UX Issues:
- Changes to the folder template UX to streamline it (e.g., PR: #1468) led to conflicts with file regex templates. This sparked discussions about balancing user expectations for different workflows.
-
API Changes:
- Transitioning to new Unsplash APIs for
random_picture functionality (introduced in version 2.4.2) caused temporary disruptions for users relying on the old functionality.
Conclusion
Templater has evolved into a powerful plugin for Obsidian, offering advanced templating capabilities and integrations. Its recent releases have focused on improving UX (e.g., autocompletions, mobile compatibility), performance (e.g., build optimization), and addressing long-standing bugs. However, the plugin's reliance on JavaScript execution and breaking changes in some updates have sparked controversy. Despite these challenges, Templater remains a cornerstone of productivity for Obsidian users who rely on automation and dynamic note management.