From bb7faef7695fa7f7a00b9b1b4fb99267813d9bfa Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Fri, 26 May 2023 14:09:05 -0300 Subject: content: transformContent: handle line breaks around lists properly --- src/content/dependencies/transformContent.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/content/dependencies/transformContent.js b/src/content/dependencies/transformContent.js index 751c58c1..bf4233fd 100644 --- a/src/content/dependencies/transformContent.js +++ b/src/content/dependencies/transformContent.js @@ -260,18 +260,27 @@ export default { // This is separated into its own function just since we're gonna reuse // it in a minute if everything goes to heck in lyrics mode. - const transformMultiline = () => - marked.parse( + const transformMultiline = () => { + const markedInput = contentFromNodes .map(node => { if (node.type === 'text') { - return node.data.replace(/\n+/g, '\n\n'); + return node.data; } else { return node.data.toString(); } }) - .join(''), - markedOptions); + .join('') + + // Compress multiple line breaks into single line breaks. + .replace(/\n{2,}/g, '\n') + // Expand line breaks which don't follow a list. + .replace(/(?