Reusable helper functions for my Obsidian scripts, QuickAdd macros, and Templater templates.
This plugin centralizes common functions like time sanitization, filename cleaning, moving files, and formatting links for internal use across all my automation scripts.
helpers-plugin/ <- GitHub repository root
├── helpers-plugin/ <- Compiled plugin for Obsidian
│ ├── main.js
│ ├── manifest.json
│ └── styles.css
├── main.ts <- Source TypeScript file (editable!)
├── .github/
│ └── workflows/
│ └── build.yml <- GitHub Actions for auto-compilation
├── README.md <- You are here!
const helpers = app.plugins.plugins["helpers-plugin"];
// Sanitize time to HH:mm format
const time = helpers.sanitizeTime("5:12 pm");
// Format an internal link to a note
const link = helpers.formatLink("MyNote");
// Move a file (returns new path if success, null if error)
const newPath = await helpers.moveFile(
"Folder/OldFile.md",
"Cleaned New Title",
"Folder/NewLocation"
);
// Calculate duration between two dates and times
const duration = helpers.calculateDuration(
"2025-04-13", // startDate
"23:15", // startTime
"2025-04-14", // endDate
"01:30" // endTime
);- Edit
main.tsin the repository root. - Add your helper function.
- Push to GitHub.
- ✅ GitHub Actions will automatically compile and update
helpers-plugin/main.js.
No manual compilation needed!
- In GitHub, click "Code → Download ZIP".
- Extract
helpers-plugin/helpers-plugin/to:.obsidian/plugins/helpers-plugin/ - Enable Helpers Plugin in Obsidian settings.
- ✅ Your helpers are now available in any QuickAdd, Templater, or other scripts.
This repository is configured with GitHub Actions.
- Whenever you update
main.ts, GitHub will automatically run the build and updatehelpers-plugin/main.js. - You don't need to compile locally!
- This plugin is for internal use inside my Obsidian vault.
- No external API calls or dangerous operations.
- Safe to keep public, as it contains no private data.
- Add more helpers as needed from other automation scripts.
- (Optional) Add helper for general filename sanitization outside moveFile.
- Maintain clear function documentation inside
main.ts.
Built for personal automation and to reduce duplication across all Obsidian workflows.