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
This commit is contained in:
AlexKucera committed 2025-10-31 13:20:31 +01:00
1 parent bdb4949c1b
commit 9ee37cd087
1 file changed
+4 -1
+4 -1
View File
@@ -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;