diff options
author | Mark Schmitz <kramred@gmail.com> | 2018-06-07 14:23:53 +0100 |
---|---|---|
committer | Mark Schmitz <kramred@gmail.com> | 2018-06-07 14:23:53 +0100 |
commit | 0deaedeeaef088040fb015f5be3e270e3bae508e (patch) | |
tree | bbdab87adf45592a6a881f808e667ba5c21312a9 /plugins/markdown/markdown.php | |
parent | f6b3295d28352cbeb46dff04799cf8f4d39087bb (diff) | |
parent | 17e45b2e9c33c736751e059276fadb480f98e621 (diff) | |
download | Shaarli-0deaedeeaef088040fb015f5be3e270e3bae508e.tar.gz Shaarli-0deaedeeaef088040fb015f5be3e270e3bae508e.tar.zst Shaarli-0deaedeeaef088040fb015f5be3e270e3bae508e.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'plugins/markdown/markdown.php')
-rw-r--r-- | plugins/markdown/markdown.php | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/plugins/markdown/markdown.php b/plugins/markdown/markdown.php index 2f24e417..821bb125 100644 --- a/plugins/markdown/markdown.php +++ b/plugins/markdown/markdown.php | |||
@@ -6,6 +6,8 @@ | |||
6 | * Shaare's descriptions are parsed with Markdown. | 6 | * Shaare's descriptions are parsed with Markdown. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | use Shaarli\Config\ConfigManager; | ||
10 | |||
9 | /* | 11 | /* |
10 | * If this tag is used on a shaare, the description won't be processed by Parsedown. | 12 | * If this tag is used on a shaare, the description won't be processed by Parsedown. |
11 | */ | 13 | */ |
@@ -50,6 +52,7 @@ function hook_markdown_render_feed($data, $conf) | |||
50 | $value = stripNoMarkdownTag($value); | 52 | $value = stripNoMarkdownTag($value); |
51 | continue; | 53 | continue; |
52 | } | 54 | } |
55 | $value['description'] = reverse_feed_permalink($value['description']); | ||
53 | $value['description'] = process_markdown( | 56 | $value['description'] = process_markdown( |
54 | $value['description'], | 57 | $value['description'], |
55 | $conf->get('security.markdown_escape', true), | 58 | $conf->get('security.markdown_escape', true), |
@@ -244,6 +247,11 @@ function reverse_space2nbsp($description) | |||
244 | return preg_replace('/(^| ) /m', '$1 ', $description); | 247 | return preg_replace('/(^| ) /m', '$1 ', $description); |
245 | } | 248 | } |
246 | 249 | ||
250 | function reverse_feed_permalink($description) | ||
251 | { | ||
252 | return preg_replace('@— <a href="([^"]+)" title="[^"]+">(\w+)</a>$@im', '— [$2]($1)', $description); | ||
253 | } | ||
254 | |||
247 | /** | 255 | /** |
248 | * Replace not whitelisted protocols with http:// in given description. | 256 | * Replace not whitelisted protocols with http:// in given description. |
249 | * | 257 | * |