« get me outta code hell

content: transformContent: be more selective about paragraph breaks - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-07-08 09:04:55 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-07-08 09:47:59 -0300
commit50242c572e33cd9b80d8f190e6ffc382fe8fe64b (patch)
tree6501ee252fca80f989361b2b0f9484c7bcd50b92 /src
parent09f7463c05ff18e68199135adce476d555f01c3d (diff)
content: transformContent: be more selective about paragraph breaks
Diffstat (limited to 'src')
-rw-r--r--src/content/dependencies/transformContent.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/content/dependencies/transformContent.js b/src/content/dependencies/transformContent.js
index 57404bae..7010e9de 100644
--- a/src/content/dependencies/transformContent.js
+++ b/src/content/dependencies/transformContent.js
@@ -270,10 +270,13 @@ export default {
 
           // Compress multiple line breaks into single line breaks.
           .replace(/\n{2,}/g, '\n')
-          // Expand line breaks which don't follow a list.
-          .replace(/(?<!^ *-.*)\n+/gm, '\n\n')
+          // Expand line breaks which don't follow a list, quote,
+          // or <br> / "  ".
+          .replace(/(?<!^ *-.*|^>.*|  $|<br>$)\n+/gm, '\n\n') /* eslint-disable-line no-regex-spaces */
           // Expand line breaks which are at the end of a list.
-          .replace(/(?<=^ *-.*)\n+(?!^ *-)/gm, '\n\n');
+          .replace(/(?<=^ *-.*)\n+(?!^ *-)/gm, '\n\n')
+          // Expand line breaks which are at the end of a quote.
+          .replace(/(?<=^>.*)\n+(?!^>)/gm, '\n\n');
 
       return marked.parse(markedInput, markedOptions);
     }