remove newlines only in the context of ordered lists - TODO check unordered

fix-spaces-bug
webzwo0i 2020-11-24 00:11:46 +01:00
parent 8d73c29f1a
commit af48a672c7
1 changed files with 6 additions and 1 deletions

View File

@ -33,7 +33,12 @@ exports.setPadHTML = async (pad, html) => {
rehype()
.use(format, opts)
.process(html, function(err, output){
html = String(output).replace(/(\r\n|\n|\r)/gm,"");
html = String(output)
.replace(/<ol>\n/gm,"<ol>")
.replace(/<\/ol>\n/gm,"</ol>")
.replace(/<li>\n/gm,"<li>")
.replace(/<\/li>\n/gm,"</li>")
.replace(/>\n<\/li>/gm,"></li>")
})
var $ = cheerio.load(html);