@excofy/utils 2.6.0 → 2.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +3 -2
- package/src/helpers/sanitize.ts +1 -1
package/dist/index.cjs
CHANGED
|
@@ -169,7 +169,7 @@ function htmlToPlainText(html) {
|
|
|
169
169
|
return "";
|
|
170
170
|
}
|
|
171
171
|
const decodedHtml = htmlEntityDecode(html);
|
|
172
|
-
const plainText = decodedHtml.replace(/<br\s*\/?>/gi, "\n").replace(/<\/p>/gi, "\n").replace(/<\/li>/gi, "\n").replace(/<li>/gi, "\u2022 ").replace(/<\/?[^>]+(>|$)/g, "").replace(
|
|
172
|
+
const plainText = decodedHtml.replace(/<br\s*\/?>/gi, "\n").replace(/<\/p>/gi, "\n").replace(/<\/li>/gi, "\n").replace(/<li>/gi, "\u2022 ").replace(/<\/?[^>]+(>|$)/g, "").replace(/(\r?\n\s*){2,}/g, "\n\n").trim();
|
|
173
173
|
return plainText;
|
|
174
174
|
}
|
|
175
175
|
|
package/dist/index.js
CHANGED
|
@@ -130,7 +130,7 @@ function htmlToPlainText(html) {
|
|
|
130
130
|
return "";
|
|
131
131
|
}
|
|
132
132
|
const decodedHtml = htmlEntityDecode(html);
|
|
133
|
-
const plainText = decodedHtml.replace(/<br\s*\/?>/gi, "\n").replace(/<\/p>/gi, "\n").replace(/<\/li>/gi, "\n").replace(/<li>/gi, "\u2022 ").replace(/<\/?[^>]+(>|$)/g, "").replace(
|
|
133
|
+
const plainText = decodedHtml.replace(/<br\s*\/?>/gi, "\n").replace(/<\/p>/gi, "\n").replace(/<\/li>/gi, "\n").replace(/<li>/gi, "\u2022 ").replace(/<\/?[^>]+(>|$)/g, "").replace(/(\r?\n\s*){2,}/g, "\n\n").trim();
|
|
134
134
|
return plainText;
|
|
135
135
|
}
|
|
136
136
|
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@excofy/utils",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.2",
|
|
4
4
|
"description": "Biblioteca de utilitários para o Excofy",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.js",
|
|
6
7
|
"type": "module",
|
|
7
8
|
"exports": {
|
|
8
9
|
".": {
|
|
9
10
|
"import": "./dist/index.js",
|
|
10
|
-
"require": "./dist/index.
|
|
11
|
+
"require": "./dist/index.cjs"
|
|
11
12
|
}
|
|
12
13
|
},
|
|
13
14
|
"scripts": {
|
package/src/helpers/sanitize.ts
CHANGED
|
@@ -131,7 +131,7 @@ export function htmlToPlainText(html: string): string {
|
|
|
131
131
|
.replace(/<\/li>/gi, '\n')
|
|
132
132
|
.replace(/<li>/gi, '• ')
|
|
133
133
|
.replace(/<\/?[^>]+(>|$)/g, '') // Remove outras tags
|
|
134
|
-
.replace(
|
|
134
|
+
.replace(/(\r?\n\s*){2,}/g, '\n\n') // Remove quebras de linha duplicadas
|
|
135
135
|
.trim();
|
|
136
136
|
|
|
137
137
|
return plainText;
|