Update index.ts

This commit is contained in:
denispol
2024-12-17 14:56:12 +01:00
committed by GitHub
parent d87584e7ad
commit e6add2869b

View File

@@ -555,8 +555,8 @@ export const removeFormattings = (str: string) => {
return str
// Block elements (remove completely)
.replace(/(```[\s\S]*?```)/g, '') // Code blocks
.replace(/^\|.*\|$/gm, '') // Tables};
// Inline elements (preserve content)
.replace(/^\|.*\|$/gm, '') // Tables
// Inline elements (preserve content)
.replace(/(?:\*\*|__)(.*?)(?:\*\*|__)/g, '$1') // Bold
.replace(/(?:[*_])(.*?)(?:[*_])/g, '$1') // Italic
.replace(/~~(.*?)~~/g, '$1') // Strikethrough