diff --git a/src/lib/components/EventDetails.svelte b/src/lib/components/EventDetails.svelte index 61d649a..cdbe669 100644 --- a/src/lib/components/EventDetails.svelte +++ b/src/lib/components/EventDetails.svelte @@ -72,10 +72,41 @@ import type { UserProfile } from "$lib/models/user_profile"; return "Untitled"; } + let parsedSummary = $state(""); + let parsedTitle = $state(""); + function getEventSummary(event: NDKEvent): string { return getMatchingTags(event, "summary")[0]?.[1] || ""; } + $effect(() => { + const summary = getEventSummary(event); + if (summary) { + parseBasicmarkup(summary).then((processed) => { + parsedSummary = processed; + }).catch((error) => { + console.error("Error parsing summary:", error); + parsedSummary = summary; + }); + } else { + parsedSummary = ""; + } + }); + + $effect(() => { + const title = getEventTitle(event); + if (title && title !== "Untitled") { + parseBasicmarkup(title).then((processed) => { + parsedTitle = processed; + }).catch((error) => { + console.error("Error parsing title:", error); + parsedTitle = title; + }); + } else { + parsedTitle = title || ""; + } + }); + function getEventTypeDisplay(event: NDKEvent): string { const [mTag, MTag] = getMimeTags(event.kind || 0); return MTag[1].split("/")[1] || `Event Kind ${event.kind}`; @@ -256,9 +287,8 @@ import type { UserProfile } from "$lib/models/user_profile"; if (repostKinds.includes(event.kind)) { parsedContent = event.content; } else { - // For all other events (including quote reposts), parse the content for nostr identifiers - // Use the proper processNostrIdentifiers function to get display names - processNostrIdentifiers(event.content, getNdkContext()).then((processed) => { + // For all other events (including quote reposts), parse the content using basic markup parser + parseBasicmarkup(event.content).then((processed) => { parsedContent = processed; }).catch((error) => { console.error("Error parsing content:", error); @@ -287,9 +317,9 @@ import type { UserProfile } from "$lib/models/user_profile";
- {#if event.kind !== 0 && getEventTitle(event)} + {#if event.kind !== 0 && parsedTitle}

- {getEventTitle(event)} + {@html parsedTitle}

{/if} @@ -321,10 +351,12 @@ import type { UserProfile } from "$lib/models/user_profile"; >
- {#if getEventSummary(event)} + {#if parsedSummary}
Summary: -

{getEventSummary(event)}

+
+ {@html parsedSummary} +
{/if} diff --git a/src/lib/components/cards/ProfileHeader.svelte b/src/lib/components/cards/ProfileHeader.svelte index 7973172..a095434 100644 --- a/src/lib/components/cards/ProfileHeader.svelte +++ b/src/lib/components/cards/ProfileHeader.svelte @@ -17,6 +17,7 @@ import { goto } from "$app/navigation"; import { isPubkeyInUserLists, fetchCurrentUserLists } from "$lib/utils/user_lists"; import { UserOutline } from "flowbite-svelte-icons"; + import { parseBasicmarkup } from "$lib/utils/markup/basicMarkupParser"; const { event, @@ -34,6 +35,7 @@ let lnurl = $state(null); let communityStatus = $state(null); let isInUserLists = $state(null); + let parsedAbout = $state(""); onMount(async () => { if (profile?.lud16) { @@ -90,6 +92,19 @@ } }); + $effect(() => { + if (profile?.about) { + parseBasicmarkup(profile.about).then((processed) => { + parsedAbout = processed; + }).catch((error) => { + console.error("Error parsing about:", error); + parsedAbout = profile.about; + }); + } else { + parsedAbout = ""; + } + }); + function navigateToIdentifier(link: string) { goto(link); } @@ -196,10 +211,14 @@
{profile.displayName}
{/if} - {#if profile.about} + {#if parsedAbout}
About:
-
{profile.about}
+
+
+ {@html parsedAbout} +
+
{/if} {#if profile.website}