diff --git a/libs/twtxt.php b/libs/twtxt.php index a94ed36..15082cb 100644 --- a/libs/twtxt.php +++ b/libs/twtxt.php @@ -70,7 +70,7 @@ function getSingleParameter($keyToFind, $string) { } $pattern = '/\s*(?!( ?.+?)((\r?\n\r?\n\w)|\Z)/'; + $replacement = '
$1$2
'; + $result = preg_replace($pattern, $replacement, $twtString); + + return $result; +} + + function embedYoutubeFromTwt(string $twtString) { // original regex source: https://gist.github.com/afeld/1254889#gistcomment-1253992 @@ -436,6 +445,8 @@ function getTwtsFromTwtxtString($url) { //$twtContent = str_replace("\u{2028}", "\n
\n", $twtContent); $twtContent = str_replace("\u{2028}", "\n", $twtContent); + $twtContent = replaceMarkdownSpoilersFromTwt($twtContent); // Testing for: https://darch.dk/timeline/conv/kwxr5aq + $twtContent = embedYoutubeFromTwt($twtContent); // Get and remove the hash