Skip to content

Commit 9b09f77

Browse files
committed
feat: - ensure consistent indentation in callouts
1 parent 452d85d commit 9b09f77

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/Query/QueryResult.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export class QueryResult {
7777
private tasksAsStringOfLines(tasks: Task[]): string {
7878
let output = '';
7979
for (const task of tasks) {
80-
output += this.toFileLineString(task).trim() + '\n';
80+
output += this.toFileLineString(task) + '\n';
8181
}
8282
return output;
8383
}
@@ -89,6 +89,6 @@ export class QueryResult {
8989
* @param task
9090
*/
9191
public toFileLineString(task: Task): string {
92-
return `${task.indentation}- [${task.status.symbol}] ${task.toString()}`;
92+
return `- [${task.status.symbol}] ${task.toString()}`;
9393
}
9494
}

tests/Query/QueryResult.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,17 @@ group by id
235235
- [ ] asterisk
236236
- [ ] plus
237237
- [ ] numbered task
238+
`);
239+
});
240+
241+
it('should remove callout prefixes', () => {
242+
const tasks = readTasksFromSimulatedFile('callout_labelled');
243+
244+
const query = '';
245+
246+
expect(searchTasksAndCopyResult(tasks, query)).toEqual(`
247+
- [ ] #task Task in 'callout_labelled'
248+
- [ ] #task Task indented in 'callout_labelled'
238249
`);
239250
});
240251
});

0 commit comments

Comments
 (0)