From 5b70df63de9f8a145b3186aef71db8b6f439dd1e Mon Sep 17 00:00:00 2001
From: Michael <heluecht@pirati.ca>
Date: Sat, 12 Nov 2022 11:20:26 +0000
Subject: [PATCH] Avoid link parsing problems in front of "share" elements

---
 src/Content/Text/BBCode.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php
index 69389cc5ff..06654b2911 100644
--- a/src/Content/Text/BBCode.php
+++ b/src/Content/Text/BBCode.php
@@ -1588,8 +1588,8 @@ class BBCode
 				$text = str_replace(">", "&gt;", $text);
 
 				// remove some newlines before the general conversion
-				$text = preg_replace("/\s?\[share(.*?)\]\s?(.*?)\s?\[\/share\]\s?/ism", "[share$1]$2[/share]", $text);
-				$text = preg_replace("/\s?\[quote(.*?)\]\s?(.*?)\s?\[\/quote\]\s?/ism", "[quote$1]$2[/quote]", $text);
+				$text = preg_replace("/\s?\[share(.*?)\]\s?(.*?)\s?\[\/share\]\s?/ism", "\n[share$1]$2[/share]\n", $text);
+				$text = preg_replace("/\s?\[quote(.*?)\]\s?(.*?)\s?\[\/quote\]\s?/ism", "\n[quote$1]$2[/quote]\n", $text);
 
 				// when the content is meant exporting to other systems then remove the avatar picture since this doesn't really look good on these systems
 				if (!$try_oembed) {