optional auto wrapping for markdownToLines

This commit is contained in:
Hans Blankenhaus 2023-09-19 17:57:59 +02:00
parent a75d14f5d0
commit 0af77a3c2c

View File

@ -9,10 +9,16 @@ import { getConfig } from '../config.js';
* @returns processed markdown * @returns processed markdown
*/ */
function preprocessMarkdown(markdown: string): string { function preprocessMarkdown(markdown: string): string {
const markdownAutoWrap = getConfig().markdownAutoWrap;
// Replace multiple newlines with a single newline // Replace multiple newlines with a single newline
const withoutMultipleNewlines = markdown.replace(/\n{2,}/g, '\n'); const withoutMultipleNewlines = markdown.replace(/\n{2,}/g, '\n');
// Remove extra spaces at the beginning of each line // Remove extra spaces at the beginning of each line
const withoutExtraSpaces = dedent(withoutMultipleNewlines); const withoutExtraSpaces = dedent(withoutMultipleNewlines);
/*
if (markdownAutoWrap === false) {
return withoutExtraSpaces.replace(/ /g, ' ');
}
*/
return withoutExtraSpaces; return withoutExtraSpaces;
} }