Replace <p> with <br /> and reeduce number of <br />
This commit is contained in:
parent
0b01ca46c9
commit
69623677e9
1 changed files with 8 additions and 1 deletions
|
@ -375,7 +375,14 @@ async function cleanHtmlFragment(
|
|||
return fragment === undefined
|
||||
? undefined
|
||||
: await prettier.format(
|
||||
fragment.replaceAll("<<", "«").replaceAll(">>", "»"),
|
||||
fragment
|
||||
.replaceAll("<<", "«")
|
||||
.replaceAll(">>", "»")
|
||||
.replace(/<p>(.*?)<\/p>/gs, "$1<br />\n\n")
|
||||
.replace(/\s*(<br\s*\/>\s*)+/gs, "<br />\n\n")
|
||||
.replace(/^\s*(<br\s*\/>\s*)+/gs, "")
|
||||
.replace(/\s*(<br\s*\/>\s*)+$/gs, "")
|
||||
.trim(),
|
||||
{
|
||||
parser: "html",
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue