From d7759d85529f34a9679e837c6393b6bbf000baa6 Mon Sep 17 00:00:00 2001 From: Daniel Austin Date: Sat, 13 Jul 2024 16:33:58 +1000 Subject: [PATCH] fix: Allow dash and asterisk marked tasks (#6) Fix for issue #6 -- allows both "- [ ]" and "* [ ]" as task indicators. --- src/main.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main.ts b/src/main.ts index 41c782d..4444f35 100644 --- a/src/main.ts +++ b/src/main.ts @@ -44,10 +44,10 @@ export default class TasksToOmnifocus extends Plugin { editorText = editor.getValue(); } try { - const tasks = editorText.match(/- \[ \] .*/g); + const tasks = editorText.match(/[-*] \[ \] .*/g); for (const task of tasks) { - const taskName = task.replace("- [ ] ", ""); + const taskName = task.replace(/[-*] \[ \] /, ""); const taskNameEncoded = encodeURIComponent(taskName); const noteURL = view.file.path.replace(/ /g, "%20").replace(/\//g, "%2F"); const vaultName = app.vault.getName().replace(/\s/g, "%20"); @@ -59,7 +59,7 @@ export default class TasksToOmnifocus extends Plugin { } if (this.settings.markComplete) { - const completedText = editorText.replace(/- \[ \]/g, "- [x]"); + const completedText = editorText.replace(/([-*]) \[ \]/g, "$1 [x]"); if (isSelection) { editor.replaceSelection(completedText); } else {