Hi all,
I’m new to TaskPaper, but I’m loving it so far.
I like to create notes under a task with information like URL’s or links to relevant files on my Mac, but when I have multiple notes entries expanded, it makes my whole document look cluttered and it’s hard to get a quick sense of what’s on my list.
Perhaps there’s a built-in way to do this, but as a software engineer, every problem looks like it needs a program to solve it.
So here’s a very short TaskPaper script that will collapse all notes that are children of tasks:
function collapseAllNotes(editor, options) {
'use strict';
// only collapse a note if it's a child of a task (we don't want to collapse any projects)
const allParentsOfNotes = editor.outline.evaluateItemPath("@type=note/parent::@type=task")
editor.setCollapsed(allParentsOfNotes)
return true;
}
Application("TaskPaper").documents[0].evaluate({
script: collapseAllNotes.toString()
});