diff --git a/src/scripts/export_consolidated_text_to_git.ts b/src/scripts/export_consolidated_text_to_git.ts index e26ffa5..e80a82e 100644 --- a/src/scripts/export_consolidated_text_to_git.ts +++ b/src/scripts/export_consolidated_text_to_git.ts @@ -375,7 +375,14 @@ async function cleanHtmlFragment( return fragment === undefined ? undefined : await prettier.format( - fragment.replaceAll("<<", "«").replaceAll(">>", "»"), + fragment + .replaceAll("<<", "«") + .replaceAll(">>", "»") + .replace(/
(.*?)<\/p>/gs, "$1
\n\n")
+ .replace(/\s*(
\s*)+/gs, "
\n\n")
+ .replace(/^\s*(
\s*)+/gs, "")
+ .replace(/\s*(
\s*)+$/gs, "")
+ .trim(),
{
parser: "html",
},