feat: change regexpresion

This commit is contained in:
Nevo David 2025-07-30 10:26:18 +07:00
parent d753619240
commit 420a844d1b
2 changed files with 3 additions and 3 deletions

View File

@ -11,6 +11,7 @@
"resolveJsonModule": true,
"isolatedModules": true,
"incremental": true,
"lib": ["es2020", "dom"],
"plugins": [
{
"name": "next"

View File

@ -177,15 +177,14 @@ export const stripHtmlValidation = (
.replace(/<ul>/, "\n<ul>")
.replace(/<\/ul>\n/, "</ul>")
.replace(
/<li.*?>(.*?)<\/li.*?>/gms,
/<li.*?>([.\s\S]*?)<\/li.*?>/gm,
(match, p1) => {
return `<li><p>- ${p1.replace(/\n/gms, '')}\n</p></li>`;
return `<li><p>- ${p1.replace(/\n/gm, '')}\n</p></li>`;
}
)
)
);
console.log(processedHtml);
return striptags(processedHtml, ['h1', 'h2', 'h3']);
}