From 79e1151ee6764b43fa35de7b36e753560c771cf0 Mon Sep 17 00:00:00 2001 From: Nesbeer <76590320+ItzNesbroDev@users.noreply.github.com> Date: Wed, 14 Dec 2022 15:51:06 +0530 Subject: [PATCH] added no-results text (#192) Fixes #182: Added no-results text --- plugs/directive/query_directive.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugs/directive/query_directive.ts b/plugs/directive/query_directive.ts index efc35a4..899f28c 100644 --- a/plugs/directive/query_directive.ts +++ b/plugs/directive/query_directive.ts @@ -26,7 +26,11 @@ export async function queryDirectiveRenderer( const rendered = await renderTemplate(parsedQuery.render, results[0]); return rendered.trim(); } else { - return jsonToMDTable(results[0]); + if (results[0].length === 0) { + return "No results"; + } else { + return jsonToMDTable(results[0]); + } } } else { throw new Error(`Too many query results: ${results.length}`);