* Shaare's descriptions are parsed with Markdown.
*/
+use Shaarli\Config\ConfigManager;
+
/*
* If this tag is used on a shaare, the description won't be processed by Parsedown.
*/
$value = stripNoMarkdownTag($value);
continue;
}
+ $value['description_src'] = $value['description'];
$value['description'] = process_markdown(
$value['description'],
$conf->get('security.markdown_escape', true),
$value = stripNoMarkdownTag($value);
continue;
}
+ $value['description'] = reverse_feed_permalink($value['description']);
$value['description'] = process_markdown(
$value['description'],
$conf->get('security.markdown_escape', true),
$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;
return preg_replace('/(^| ) /m', '$1 ', $description);
}
+function reverse_feed_permalink($description)
+{
+ return preg_replace('@— <a href="([^"]+)" title="[^"]+">(\w+)</a>$@im', '— [$2]($1)', $description);
+}
+
/**
* Replace not whitelisted protocols with http:// in given description.
*
$description);
}
$description = preg_replace(
- '#(<[^>]+)on[a-z]*="?[^ "]*"?#is',
+ '#(<[^>]+\s)on[a-z]*="?[^ "]*"?#is',
'$1',
$description);
return $description;