Skip to content

Instantly share code, notes, and snippets.

Created April 30, 2022 05:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save beet/b5712d693b6cd61c8a4366453f2c0a3f to your computer and use it in GitHub Desktop.
Save beet/b5712d693b6cd61c8a4366453f2c0a3f to your computer and use it in GitHub Desktop.
Obsidian Templater script to convert the current line to a Tasks plugin task

Line to scheduled task

By combining the core daily notes plugin with the Tasks plugin, Obsidian now has quite a compreshensive todo and task management solution.

It's not quite as tight as a native app like NotePlan however.

This little template script for the Templater plugin fills the gap for a couple of use-cases

  • adding a task to a daily note, without having to remember to schedule it to be due on that date
  • quickly adding a task to a project note that is scheduled for the current date

On my Macs, I have the template assigned to SHIFT + COMMAND + S.

Then, I can either use COMMAND + T to jump to today's daily note, or I've assigned SHIFT + COMMAND + J to use the Obsidian-42 - Jump-to-date plugin to jump to an arbitrary date, and hit SHIFT + COMMAND + S to quickly schedule a task for that date.

In project notes, I use the template to quickly add ad-hoc todos within my notes, or to add them to a dedicated tasks section that I keep at the top of each page.

Mobile integration

This is especially useful on my Onyx Boox Nova Air C, where I use the Android share sheet to send links from Feedly to Obsidian, which gives the option to append it to today's daily note.

I've setup Obsidian's mobile toolbar to invoke the Templater plugin's insert modal template, so I can just select this template to convert the link to a todo that's scheduled for today.

On my dashboard, it will show up as scheduled for today, or if I don't get to it, will still appear as overdue, so it won't drop off my radar.

This gives a neat method of ubiquitous capture.

When I'm back on my Mac, where I have my vault syncing across with Obsidian Sync, I then process these items out to project pages in NotePlan, or just act on them immediately, GTD style.


due today
not done
done today


not done
due before today
let cmEditorAct =;
// Get contents of line under custor
let currentCursor = cmEditorAct.getCursor();
let currentLine = currentCursor.line;
let lineContents = cmEditorAct.getLine(currentLine);
let taskDescription = lineContents;
// Is this a daily note?
let dateRegex = /^[\d]{4}-[\d]{2}-[\d]{2}$/;
let taskDate = null;
if(tp.file.title.match(dateRegex)) {
taskDate = tp.file.title;
} else {
taskDate =;
// Prompt for the task description
if(taskDescription == "") {
taskDescription = await tp.system.prompt("Enter task to be scheduled on " + taskDate)
// no-op if no task has been entered
if(taskDescription == "" || taskDescription == null)
// Replace line with scheduled task
"- [ ] " + taskDescription + " 📅 " + taskDate,
{ line: currentLine, ch: 0},
{ line: currentLine, ch: lineContents.length}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment