Skip to content

Commit e7e7725

Browse files
committed
feat: - render explanation in Markdown
1 parent c0fc458 commit e7e7725

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

src/Renderer/MarkdownQueryResultsRenderer.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@ export class MarkdownQueryResultsRenderer extends QueryResultsRendererBase {
4040
return;
4141
}
4242

43-
protected renderExplanation(_explanation: string | null): void {
44-
return;
43+
protected renderExplanation(explanation: string | null): void {
44+
if (explanation) {
45+
this.markdownLines.push(explanation);
46+
}
4547
}
4648

4749
protected renderErrorMessage(_errorMessage: string): void {

tests/Renderer/MarkdownQueryResultsRenderer.test.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,4 +249,20 @@ group by id
249249
"
250250
`);
251251
});
252+
253+
it('should render the explanation', async () => {
254+
const tasks = readTasksFromSimulatedFile('callout_labelled');
255+
256+
const markdown = await renderMarkdown('explain\ndescription includes indented', tasks);
257+
258+
expect(markdown).toMatchInlineSnapshot(`
259+
"
260+
Explanation of this Tasks code block query:
261+
262+
description includes indented
263+
264+
- [ ] #task Task indented in 'callout_labelled'
265+
"
266+
`);
267+
});
252268
});

0 commit comments

Comments
 (0)