From 0f356acee849ff9f6ae03f06511f02eccbd104ca Mon Sep 17 00:00:00 2001 From: Andreas Date: Thu, 17 Nov 2022 20:34:23 +0100 Subject: [PATCH] restrict html tags after which to detect a hashtag Hashtags should not be detected after just any html tag - for example not after an opening a or div. To still allow detection at the start of a line, allow specifically p and br to directly precede a hashtag. --- activitypub.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activitypub.php b/activitypub.php index ae9f115..c9bca18 100644 --- a/activitypub.php +++ b/activitypub.php @@ -19,7 +19,7 @@ namespace Activitypub; * Initialize plugin */ function init() { - \defined( 'ACTIVITYPUB_HASHTAGS_REGEXP' ) || \define( 'ACTIVITYPUB_HASHTAGS_REGEXP', '(?:(?<=[\s>])|^)#([A-Za-z0-9_]+)(?:(?=\s|[[:punct:]]))' ); + \defined( 'ACTIVITYPUB_HASHTAGS_REGEXP' ) || \define( 'ACTIVITYPUB_HASHTAGS_REGEXP', '(?:(?<=\s)|(?<=

)|(?<=
)|^)#([A-Za-z0-9_]+)(?:(?=\s|[[:punct:]]|$))' ); \defined( 'ACTIVITYPUB_ALLOWED_HTML' ) || \define( 'ACTIVITYPUB_ALLOWED_HTML', '