diff --git a/lib/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx b/lib/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx
index 66a82e7e..75b831d2 100644
--- a/lib/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx
+++ b/lib/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx
@@ -1,9 +1,3 @@
-/* eslint-disable @typescript-eslint/no-unsafe-assignment */
-/* eslint-disable @typescript-eslint/restrict-plus-operands */
-/* eslint-disable @typescript-eslint/no-unsafe-return */
-/* eslint-disable @typescript-eslint/no-unsafe-member-access */
-/* eslint-disable @typescript-eslint/no-unsafe-call */
-
import { RichTextEditor } from '#components/Input/RichTextEditor/RichTextEditor'
import { fixUrls, mailRegex } from '#utils/ReplaceURLs'
@@ -36,7 +30,7 @@ export const TextView = ({
innerText = text
}
- if (innerText && truncate) innerText = truncateText(removeMarkdownKeepParagraphs(innerText), 100)
+ if (innerText && truncate) innerText = truncateMarkdown(innerText, 100)
if (innerText) replacedText = fixUrls(innerText)
@@ -49,54 +43,6 @@ export const TextView = ({
return
}
-function removeMarkdownKeepParagraphs(text: string): string {
- return (
- text
- // 1) Bilder entfernen
- .replace(/!\[.*?\]\(.*?\)/g, '')
- // 2) Markdown-Links [Text](URL) → URL
- .replace(/\[.*?\]\(\s*(https?:\/\/[^\s)]+)\s*\)/g, '$1')
- // 3) Autolinks → http://…
- .replace(/<\s*(https?:\/\/[^\s>]+)\s*>/g, '$1')
- // 4) Code-Fences und Inline-Code entfernen
- .replace(/```[\s\S]*?```/g, '')
- .replace(/`([^`]+)`/g, '$1')
- // 8) Tabellen-Pipes entfernen
- .replace(/^\|(.+)\|$/gm, '$1')
- .replace(/^\s*\|[-\s|]+\|$/gm, '')
- // 9) Blockquotes
- .replace(/^>\s+(.*)$/gm, '$1')
- // 10) Echte HTML-Tags (außer Absätze) entfernen
- .replace(/<(?!\s*\/?\s*p\s*>)[^>]+>/g, '')
- // 11) Zeilenumbrüche normalisieren
- .replace(/\r\n|\r/g, '\n')
- // 12) Mehrfache Leerzeilen auf max. 2 reduzieren
- .replace(/\n{3,}/g, '\n\n')
- // 13) Trim
- .trim()
- )
-}
-
-function truncateText(text, limit) {
- if (text.length <= limit) {
- return text
- }
-
- let truncated = ''
- let length = 0
-
- // Split the text by paragraphs
- const paragraphs = text.split('\n')
-
- for (const paragraph of paragraphs) {
- if (length + paragraph.length > limit) {
- truncated += paragraph.slice(0, limit - length) + '...'
- break
- } else {
- truncated += paragraph + '\n'
- length += paragraph.length
- }
- }
-
- return truncated.trim()
+export function truncateMarkdown(markdown: string, limit: number): string {
+ return markdown.slice(0, limit)
}
diff --git a/lib/src/Components/Templates/OverlayItemsIndexPage.tsx b/lib/src/Components/Templates/OverlayItemsIndexPage.tsx
index 094ec95f..8552ecd4 100644
--- a/lib/src/Components/Templates/OverlayItemsIndexPage.tsx
+++ b/lib/src/Components/Templates/OverlayItemsIndexPage.tsx
@@ -157,8 +157,8 @@ export const OverlayItemsIndexPage = ({
: 0
return dateB - dateA // Subtracts milliseconds which are numbers
})
- .map((i, k) => (
-