Fix hashtags with markdown escape enabled

They're now transformed to markdown syntax links before processing them through Parsedown.

Fixes 
This commit is contained in:
ArthurHoaro 2018-08-14 12:26:51 +02:00
parent f28b73b21f
commit cb7940e2de
6 changed files with 47 additions and 6 deletions
plugins/markdown

View file

@ -215,6 +215,15 @@ function reverse_text2clickable($description)
$descriptionLine
);
// Make hashtag links markdown ready, otherwise the links will be ignored with escape set to true
if (!$codeBlockOn && !$codeLineOn) {
$descriptionLine = preg_replace(
'#<a href="([^ ]*)"'. $hashtagTitle .'>([^<]+)</a>#m',
'[$2]($1)',
$descriptionLine
);
}
$descriptionOut .= $descriptionLine;
if ($lineCount++ < count($descriptionLines) - 1) {
$descriptionOut .= PHP_EOL;