diff --git a/docs/Queries/Grouping.md b/docs/Queries/Grouping.md index 4d0d7d81ad..ef403243ca 100644 --- a/docs/Queries/Grouping.md +++ b/docs/Queries/Grouping.md @@ -828,6 +828,19 @@ group by function task.originalMarkdown.replace(/^[^\[\]]+\[.\] */, '') +### Line Number + +There is no built-in instruction to group by the task's line number. + +Since Tasks X.Y.Z, **[[Custom Sorting|custom sorting]] by the task's line number** is now possible, using `task.lineNumber`. + +> [!tip] +> With `task.lineNumber`, the first line in the file is on line number `0` (zero), not `1` (one). + + + + + ## Group by File Properties ### File Path diff --git a/tests/Scripting/ScriptingReference/CustomFiltering/CustomFilteringExamples.test.ts b/tests/Scripting/ScriptingReference/CustomFiltering/CustomFilteringExamples.test.ts index 3e9142bcb5..e6d89afe46 100644 --- a/tests/Scripting/ScriptingReference/CustomFiltering/CustomFilteringExamples.test.ts +++ b/tests/Scripting/ScriptingReference/CustomFiltering/CustomFilteringExamples.test.ts @@ -679,7 +679,7 @@ describe('other properties', () => { 'task.lineNumber', // comment to force line break [], - SampleTasks.withRepresentativeTags(), + SampleTasks.withRepresentativeLineNumbers(), ], [ diff --git a/tests/Scripting/ScriptingReference/CustomGrouping/CustomGroupingExamples.test.other_properties_task.lineNumber_docs.approved.md b/tests/Scripting/ScriptingReference/CustomGrouping/CustomGroupingExamples.test.other_properties_task.lineNumber_docs.approved.md new file mode 100644 index 0000000000..ee4009372d --- /dev/null +++ b/tests/Scripting/ScriptingReference/CustomGrouping/CustomGroupingExamples.test.other_properties_task.lineNumber_docs.approved.md @@ -0,0 +1,5 @@ + + + + + diff --git a/tests/Scripting/ScriptingReference/CustomGrouping/CustomGroupingExamples.test.other_properties_task.lineNumber_results.approved.txt b/tests/Scripting/ScriptingReference/CustomGrouping/CustomGroupingExamples.test.other_properties_task.lineNumber_results.approved.txt new file mode 100644 index 0000000000..52d85221c1 --- /dev/null +++ b/tests/Scripting/ScriptingReference/CustomGrouping/CustomGroupingExamples.test.other_properties_task.lineNumber_results.approved.txt @@ -0,0 +1,3 @@ +Results of custom groupers + + diff --git a/tests/Scripting/ScriptingReference/CustomGrouping/CustomGroupingExamples.test.ts b/tests/Scripting/ScriptingReference/CustomGrouping/CustomGroupingExamples.test.ts index 29858c59a3..ad5bb2218b 100644 --- a/tests/Scripting/ScriptingReference/CustomGrouping/CustomGroupingExamples.test.ts +++ b/tests/Scripting/ScriptingReference/CustomGrouping/CustomGroupingExamples.test.ts @@ -690,6 +690,13 @@ describe('other properties', () => { SampleTasks.withRepresentativeTags(), ], + [ + 'task.lineNumber', + // comment to force line break + [], + SampleTasks.withRepresentativeLineNumbers(), + ], + [ 'task.urgency', [