diff options
author | ArthurHoaro <arthur@hoa.ro> | 2018-10-06 13:28:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-06 13:28:51 +0200 |
commit | fa8100c088ac990fde08a872816ea7dcfbf54202 (patch) | |
tree | e905192000d9f2d840a3151d6cb8331148f55506 /plugins | |
parent | 86e1bc713fd7fa74d6a17a7687428fa1c6d3c5f2 (diff) | |
parent | cb7940e2deacba66f2510816732be654b255cc70 (diff) | |
download | Shaarli-fa8100c088ac990fde08a872816ea7dcfbf54202.tar.gz Shaarli-fa8100c088ac990fde08a872816ea7dcfbf54202.tar.zst Shaarli-fa8100c088ac990fde08a872816ea7dcfbf54202.zip |
Merge pull request #1212 from ArthurHoaro/hotfix/hashtag-md-escape
Fix hashtags with markdown escape enabled
Diffstat (limited to 'plugins')
-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; |