Skip to content

Instantly share code, notes, and snippets.

@arafatm
Last active November 26, 2024 19:04
Show Gist options
  • Select an option

  • Save arafatm/b36caaf22c03be7323eae09524ad6dc1 to your computer and use it in GitHub Desktop.

Select an option

Save arafatm/b36caaf22c03be7323eae09524ad6dc1 to your computer and use it in GitHub Desktop.
Obsidian templater to inline replace a string
// 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