From 9ee37cd08732068f56b2f283809c15dc6fe9508a Mon Sep 17 00:00:00 2001 From: Alexander Kucera Date: Fri, 31 Oct 2025 13:20:31 +0100 Subject: [PATCH] Sanitizes writing prompts for consistent formatting Prevents potential formatting issues by ensuring prompts are single-line and trimmed Collapses multiple whitespaces and trims prompt text to maintain clean, uniform list rendering in markdown output --- commands/notePrompts.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/commands/notePrompts.ts b/commands/notePrompts.ts index 2bbd3d8..b7fe991 100644 --- a/commands/notePrompts.ts +++ b/commands/notePrompts.ts @@ -158,7 +158,10 @@ export class NotePromptsCommand { let formatted = `## Writing Prompts (${timestamp})\n\n`; prompts.forEach((prompt, index) => { - formatted += `${index + 1}. ${prompt}\n\n`; + // Sanitize to single line: collapse whitespace and trim + // Prevents malformed prompts with newlines from breaking list formatting + const oneLine = String(prompt).replace(/\s+/g, ' ').trim(); + formatted += `${index + 1}. ${oneLine}\n\n`; }); return formatted;