aboutsummaryrefslogtreecommitdiffhomepage
path: root/plugins
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2018-05-19 12:55:43 +0200
committerArthurHoaro <arthur@hoa.ro>2018-05-19 12:55:43 +0200
commitdd6794cff8a1f26c4d08544d89e1df1f521dcb26 (patch)
treec0bb89271fa80c048bb060b8bb8a9310ad55bb90 /plugins
parent73da3a269bd3a636b4764f858e42dcc096e5e0a5 (diff)
downloadShaarli-dd6794cff8a1f26c4d08544d89e1df1f521dcb26.tar.gz
Shaarli-dd6794cff8a1f26c4d08544d89e1df1f521dcb26.tar.zst
Shaarli-dd6794cff8a1f26c4d08544d89e1df1f521dcb26.zip
Fix feed permalink rendering with markdown escape set to true
Fixes #1134
Diffstat (limited to 'plugins')
-rw-r--r--plugins/markdown/markdown.php8
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
9use 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('/(^| )&nbsp;/m', '$1 ', $description); 247 return preg_replace('/(^| )&nbsp;/m', '$1 ', $description);
245} 248}
246 249
250function reverse_feed_permalink($description)
251{
252 return preg_replace('@&#8212; <a href="([^"]+)" title="[^"]+">(\w+)</a>$@im', '&#8212; [$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 *