diff options
author | ArthurHoaro <arthur@hoa.ro> | 2018-08-14 12:26:51 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2018-08-14 12:26:51 +0200 |
commit | cb7940e2deacba66f2510816732be654b255cc70 (patch) | |
tree | 0f0e99a25f99e88204c5962b4bdd2f15a2b5041c /plugins/markdown | |
parent | f28b73b21f705102f8536cd16ea28122aa870e49 (diff) | |
download | Shaarli-cb7940e2deacba66f2510816732be654b255cc70.tar.gz Shaarli-cb7940e2deacba66f2510816732be654b255cc70.tar.zst Shaarli-cb7940e2deacba66f2510816732be654b255cc70.zip |
Fix hashtags with markdown escape enabled
They're now transformed to markdown syntax links before processing them through Parsedown.
Fixes #1210
Diffstat (limited to 'plugins/markdown')
-rw-r--r-- | plugins/markdown/markdown.php | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/plugins/markdown/markdown.php b/plugins/markdown/markdown.php index 821bb125..21972814 100644 --- a/plugins/markdown/markdown.php +++ b/plugins/markdown/markdown.php | |||
@@ -215,6 +215,15 @@ function reverse_text2clickable($description) | |||
215 | $descriptionLine | 215 | $descriptionLine |
216 | ); | 216 | ); |
217 | 217 | ||
218 | // Make hashtag links markdown ready, otherwise the links will be ignored with escape set to true | ||
219 | if (!$codeBlockOn && !$codeLineOn) { | ||
220 | $descriptionLine = preg_replace( | ||
221 | '#<a href="([^ ]*)"'. $hashtagTitle .'>([^<]+)</a>#m', | ||
222 | '[$2]($1)', | ||
223 | $descriptionLine | ||
224 | ); | ||
225 | } | ||
226 | |||
218 | $descriptionOut .= $descriptionLine; | 227 | $descriptionOut .= $descriptionLine; |
219 | if ($lineCount++ < count($descriptionLines) - 1) { | 228 | if ($lineCount++ < count($descriptionLines) - 1) { |
220 | $descriptionOut .= PHP_EOL; | 229 | $descriptionOut .= PHP_EOL; |