|
|
|
@ -12,12 +12,16 @@ const convert = (html: string) =>
|
|
|
|
|
listStyle: "linebreak", |
|
|
|
|
}) |
|
|
|
|
export const htmlToText = (html: string) => { |
|
|
|
|
const text = convert(html) |
|
|
|
|
|
|
|
|
|
return text |
|
|
|
|
.replaceAll(/&\w*;/g, "") |
|
|
|
|
.replaceAll(/<!--\s?(.|\R|\s)*?-->/g, "") |
|
|
|
|
.replaceAll(/<.*><\/.*>/g, "") |
|
|
|
|
try { |
|
|
|
|
const text = convert(html) |
|
|
|
|
return text |
|
|
|
|
.replaceAll(/&\w*;/g, "") |
|
|
|
|
.replaceAll(/<!--\s?(.|\R|\s)*?-->/g, "") |
|
|
|
|
.replaceAll(/<.*><\/.*>/g, "") |
|
|
|
|
} catch (e) { |
|
|
|
|
console.log("htmlToText", e) |
|
|
|
|
return "" |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export const SHOULD_NOT_PARSE = "SHOULD_NOT_PARSE" |
|
|
|
|