feat: parse misconfigured html
This commit is contained in:
parent
ef0b668770
commit
d2354c0427
|
|
@ -27,6 +27,7 @@ export const GeneralPreviewComponent: FC<{
|
|||
true
|
||||
);
|
||||
|
||||
console.log('newConetnt', newContent);
|
||||
const { start, end } = textSlicer(
|
||||
integration?.identifier || '',
|
||||
props.maximumCharacters || 10000,
|
||||
|
|
@ -45,6 +46,7 @@ export const GeneralPreviewComponent: FC<{
|
|||
}) +
|
||||
`</mark>`;
|
||||
|
||||
console.log(finalValue);
|
||||
return { text: finalValue, images: p.image };
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import striptags from 'striptags';
|
||||
import { parseFragment, serialize } from 'parse5';
|
||||
|
||||
const bold = {
|
||||
a: '𝗮',
|
||||
|
|
@ -132,11 +133,13 @@ const underlineMap = {
|
|||
|
||||
export const stripHtmlValidation = (
|
||||
type: 'none' | 'normal' | 'markdown' | 'html',
|
||||
value: string,
|
||||
val: string,
|
||||
replaceBold = false,
|
||||
none = false,
|
||||
convertMentionFunction?: (idOrHandle: string, name: string) => string
|
||||
): string => {
|
||||
const value = serialize(parseFragment(val));
|
||||
|
||||
if (type === 'html') {
|
||||
return striptags(convertMention(value, convertMentionFunction), [
|
||||
'ul',
|
||||
|
|
|
|||
|
|
@ -153,7 +153,9 @@ export class TelegramProvider extends SocialAbstract implements SocialProvider {
|
|||
])
|
||||
.replace(/<strong>/g, '<b>')
|
||||
.replace(/<\/strong>/g, '</b>')
|
||||
.replace(/<p>(.*?)<\/p>/g, '$1\n')
|
||||
.replace(/<p>(.*?)<\/p>/g, '$1\n');
|
||||
|
||||
console.log(text);
|
||||
// check if media is local to modify url
|
||||
const processedMedia = mediaFiles.map((media) => {
|
||||
let mediaUrl = media.path;
|
||||
|
|
|
|||
|
|
@ -173,6 +173,7 @@
|
|||
"nostr-tools": "^2.10.4",
|
||||
"openai": "^5.11.0",
|
||||
"p-limit": "^3.1.0",
|
||||
"parse5": "^8.0.0",
|
||||
"polotno": "^2.10.5",
|
||||
"posthog-js": "^1.178.0",
|
||||
"react": "18.3.1",
|
||||
|
|
|
|||
|
|
@ -399,6 +399,9 @@ importers:
|
|||
p-limit:
|
||||
specifier: ^3.1.0
|
||||
version: 3.1.0
|
||||
parse5:
|
||||
specifier: ^8.0.0
|
||||
version: 8.0.0
|
||||
polotno:
|
||||
specifier: ^2.10.5
|
||||
version: 2.25.1(@types/react@18.3.1)(@types/sortablejs@1.15.8)(react-dom@18.3.1(react@18.3.1))(react-native@0.80.1(@babel/core@7.28.0)(@types/react@18.3.1)(bufferutil@4.0.9)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)
|
||||
|
|
@ -12276,6 +12279,9 @@ packages:
|
|||
parse5@7.3.0:
|
||||
resolution: {integrity: sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw==}
|
||||
|
||||
parse5@8.0.0:
|
||||
resolution: {integrity: sha512-9m4m5GSgXjL4AjumKzq1Fgfp3Z8rsvjRNbnkVwfu2ImRqE5D0LnY2QfDen18FSY9C573YU5XxSapdHZTZ2WolA==}
|
||||
|
||||
parseley@0.12.1:
|
||||
resolution: {integrity: sha512-e6qHKe3a9HWr0oMRVDTRhKce+bRO8VGQR3NyVwcjwrbhMmFCX9KszEV35+rn4AdilFAq9VPxP/Fe1wC9Qjd2lw==}
|
||||
|
||||
|
|
@ -30956,6 +30962,10 @@ snapshots:
|
|||
dependencies:
|
||||
entities: 6.0.1
|
||||
|
||||
parse5@8.0.0:
|
||||
dependencies:
|
||||
entities: 6.0.1
|
||||
|
||||
parseley@0.12.1:
|
||||
dependencies:
|
||||
leac: 0.6.0
|
||||
|
|
|
|||
Loading…
Reference in New Issue