From 44f8900902fd6fd705b6f4cd81dca9782efd0b4e Mon Sep 17 00:00:00 2001 From: xmflsct Date: Sat, 7 Jan 2023 16:41:14 +0100 Subject: [PATCH] Support broader fedi tag type --- src/components/Parse/HTML.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/Parse/HTML.tsx b/src/components/Parse/HTML.tsx index a9e213af..194ad3d6 100644 --- a/src/components/Parse/HTML.tsx +++ b/src/components/Parse/HTML.tsx @@ -119,7 +119,11 @@ const ParseHTML: React.FC = ({ const href = node.attribs.href if (classes) { if (classes.includes('hashtag')) { - const tag = href.match(new RegExp(/\/tags?\/(.*)/, 'i'))?.[1].toLowerCase() + const children = node.children.map(unwrapNode).join('') + const tag = + href.match(new RegExp(/\/tags?\/(.*)/, 'i'))?.[1]?.toLowerCase() || + children.match(new RegExp(/#(\S+)/))?.[1]?.toLowerCase() + const paramsHashtag = (params as { hashtag: Mastodon.Tag['name'] } | undefined) ?.hashtag const sameHashtag = paramsHashtag === tag @@ -143,7 +147,7 @@ const ParseHTML: React.FC = ({ !sameHashtag && navigation.push('Tab-Shared-Hashtag', { hashtag: tag }) } - children={node.children.map(unwrapNode).join('')} + children={children} /> ) }