Skip to content

πŸ“¨ The ultimate agentic social media scheduling tool πŸ€–

fix: markdown conversion regexes tolerate paragraph and heading attributes

Gilad Resisi080783772f10
diff --git a/libraries/helpers/src/utils/strip.html.validation.ts b/libraries/helpers/src/utils/strip.html.validation.ts
index 62e5245e0..719aa6eb8 100644
--- a/libraries/helpers/src/utils/strip.html.validation.ts
+++ b/libraries/helpers/src/utils/strip.html.validation.ts
@@ -187,17 +187,17 @@ export const stripHtmlValidation = (
return striptags(
convertMention(
value
- .replace(/<h1>([.\s\S]*?)<\/h1>/g, (match, p1) => {
+ .replace(/<h1[^>]*>([.\s\S]*?)<\/h1>/g, (match, p1) => {
return `<h1># ${p1}</h1>\n`;
})
.replace(/&amp;/gi, '&')
.replace(/&nbsp;/gi, ' ')
.replace(/&quot;/gi, '"')
.replace(/&#39;/gi, "'")
- .replace(/<h2>([.\s\S]*?)<\/h2>/g, (match, p1) => {
+ .replace(/<h2[^>]*>([.\s\S]*?)<\/h2>/g, (match, p1) => {
return `<h2>## ${p1}</h2>\n`;
})
- .replace(/<h3>([.\s\S]*?)<\/h3>/g, (match, p1) => {
+ .replace(/<h3[^>]*>([.\s\S]*?)<\/h3>/g, (match, p1) => {
return `<h3>### ${p1}</h3>\n`;
})
.replace(/<u>([.\s\S]*?)<\/u>/g, (match, p1) => {
@@ -209,7 +209,7 @@ export const stripHtmlValidation = (
.replace(/<li.*?>([.\s\S]*?)<\/li.*?>/gm, (match, p1) => {
return `<li>- ${p1.replace(/\n/gm, '')}</li>`;
})
- .replace(/<p>([.\s\S]*?)<\/p>/g, (match, p1) => {
+ .replace(/<p[^>]*>([.\s\S]*?)<\/p>/g, (match, p1) => {
return `<p>${p1}</p>\n`;
})
.replace(