Last active
November 26, 2024 19:04
-
-
Save arafatm/b36caaf22c03be7323eae09524ad6dc1 to your computer and use it in GitHub Desktop.
Obsidian templater to inline replace a string
This file contains hidden or 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
| // rename to templater/{filename}.md | |
| // Stole from | |
| // Different checkboxes for the Minimal theme · SilentVoid13/Templater · Discussion #991 | |
| // https://github.com/SilentVoid13/Templater/discussions/991 | |
| <%* | |
| let editor = app.workspace.activeLeaf.view.editor; | |
| let cursor = editor.getCursor("from"); | |
| let text = editor.getLine(cursor.line); | |
| text = text.replace(/\u{1F3AF}/gu, `✅ ${tp.date.now("YY.MM.DD")}`); // 🎯 | |
| text = text.replace(/\u{1F3B1}/gu, `✅ ${tp.date.now("YY.MM.DD")}`); // ❗ | |
| text = text.replace(/\u{2757}/gu, `✅ ${tp.date.now("YY.MM.DD")}`); // 🎱 | |
| editor.setLine(cursor.line, text); | |
| %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment