From 2c780635f3b55f257c59cfccab73206bed298261 Mon Sep 17 00:00:00 2001 From: Lorenzo Mangani Date: Sat, 14 Dec 2024 00:48:03 +0100 Subject: [PATCH] Update index.ts --- src/index.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index c202da9..fc64326 100644 --- a/src/index.ts +++ b/src/index.ts @@ -61,15 +61,14 @@ async function executeQueryTable(query: string): Promise { // const chunks = ['```sql\n', query, ' \n', '```\n', '\n']; // Format the result into a markdown table if (result.length > 0) { - chunks.push('```\n'); const headers = Object.keys(result[0]); chunks.push('| ' + headers.join(' | ') + ' |\n'); - chunks.push('|' + headers.map(() => '---').join('|') + ' |\n'); + chunks.push('| ' + headers.map(() => '---').join(' | ') + ' |\n'); result.forEach(row => { const values = headers.map(header => row[header]); chunks.push('| ' + values.join(' | ') + ' |\n'); }); - chunks.push('```\n'); + chunks.push('\n'); } else { chunks.push('No results found.\n'); }