From e383daaae18a66472f39ba6a81add0332aa7a5a6 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Wed, 5 Jun 2024 12:12:11 -0500 Subject: [PATCH] Fix linkification of bare domains --- src/utils/note.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/utils/note.ts b/src/utils/note.ts index 36ded28..6e0d8d4 100644 --- a/src/utils/note.ts +++ b/src/utils/note.ts @@ -16,7 +16,7 @@ const linkifyOpts: linkify.Opts = { const href = Conf.local(`/tags/${tag}`); return `#${tag}`; }, - url: ({ content }) => { + url: ({ attributes, content }) => { try { const { decoded } = nip21.parse(content); const pubkey = getDecodedPubkey(decoded); @@ -28,7 +28,11 @@ const linkifyOpts: linkify.Opts = { return ''; } } catch { - return `${content}`; + const attr = Object.entries(attributes) + .map(([name, value]) => `${name}="${value}"`) + .join(' '); + + return `${content}`; } }, },