You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 8c890aa
Browse filesBrowse the repository at this point in the historyBrowse files
Priority markers follow NotePlan's rule: leading !, !!, !!! or >> followed by a space
- New helpers/taskPriority.js (no imports): the single definition of what counts
as a priority marker, plus get/remove/set/next-level helpers.
- paragraph.js: getTaskPriority, removeTaskPriorityIndicators, changePriority and
cyclePriorityStateUp/Down use it. changePriority no longer strips every '!'
in the line (which turned '!>date' due dates into '>date' scheduled dates and
mangled 'Wow!' and images). Cycling down from none now goes to '>>'.
- sorting.js: getNumericPriority no longer counts '!!!!', '!x' (no space) or a
leading due date ('!>2026-12-05 ...') as a priority; '>>' needs a space too.
- HTMLView.js: preview priority styling uses the same rule.
- TaskAutomations: drop the '!!!!' (p4) option, which isn't a NotePlan
priority; '__p4__' now writes '>>'.
Closes#796
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
// not in middle of word, or starting an image tag
910
-
// Note: this second (unanchored) match is guaranteed to succeed if the test above did, but it can find an earlier
911
-
// run of '!'s than the one the test matched, so keep it as a separate match rather than re-using the test's result.
912
-
constexclamationMatch=content.match(/\B\!+\B/)
913
-
if(exclamationMatch){
914
-
returnexclamationMatch[0].length
915
-
}
916
-
}
917
-
if(content.match(/^>>/)){
918
-
return 4
919
-
}
920
-
return0
909
+
returngetPriorityLevel(content)
921
910
}
922
911
923
912
/**
924
-
* Remove task Priority Indicators (!, !!, !!!, >>) from start of content (was: any where in line except starting an image tag, or at start/end of a word).
913
+
* Remove the task's priority marker ('!', '!!', '!!!' or '>>' plus a space, at the start of the content).
925
914
* @param {string} content
926
-
* @returns {string} content minus any priority indicators
915
+
* @returns {string} content minus its priority marker
// let output = content.replace(/\B\!+\B(?!\[)/g, '') // not in middle of word, or starting an image tag
930
-
letoutput=content.replace(/^!{1,3}\s/,'')// start of line only
931
-
output=output.replace(/^>>\s?/,'')// start of line only
932
-
returnoutput
918
+
returnremovePriorityMarker(content)
933
919
}
934
920
935
921
/**
936
-
* Change the priority in a task to '!', '!!', '!!!', '>>' (or remove priority)
922
+
* Change the priority in a task to '!', '!!', '!!!', '>>' (or remove priority).
923
+
* Only the leading marker is replaced: any other '!' in the text (e.g. a due date '!>2026-12-05', an image '',
924
+
* or 'Wow!') is left alone. (Before 2026-12 every '!' in the line was removed.)
937
925
* @author@dwertheimer updated by @jgclark
938
926
* @param {TParagraph} input - the task/pagraph to be processed
939
-
* @param {string} priorityString - the new priority (!,!!,!!! or '' for none)
927
+
* @param {string} priorityString - the new priority ('!', '!!', '!!!', '>>', or '' for none)
940
928
* @param {boolean} - commit the change after the change is made (default false)
941
929
* @returns {string} the resulting updated paragraph's content
942
930
* Note: If the third param is missing or false, THE CHANGE HAS NOT BEEN COMMITTED YET. You should use note.updateParagraph(s) to commit the change you receive back.
943
931
* Note: Ideally lives in NPParagraph.js, but putting it here avoids a circular dependency
0 commit comments