diff options
Diffstat (limited to 'plugins/markdown/markdown.php')
-rw-r--r-- | plugins/markdown/markdown.php | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/plugins/markdown/markdown.php b/plugins/markdown/markdown.php index 57fcce32..5f56ecc2 100644 --- a/plugins/markdown/markdown.php +++ b/plugins/markdown/markdown.php | |||
@@ -10,9 +10,8 @@ require_once 'Parsedown.php'; | |||
10 | 10 | ||
11 | /* | 11 | /* |
12 | * 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. |
13 | * Using a private tag so it won't appear for visitors. | ||
14 | */ | 13 | */ |
15 | define('NO_MD_TAG', '.nomarkdown'); | 14 | define('NO_MD_TAG', 'nomarkdown'); |
16 | 15 | ||
17 | /** | 16 | /** |
18 | * Parse linklist descriptions. | 17 | * Parse linklist descriptions. |
@@ -25,11 +24,11 @@ function hook_markdown_render_linklist($data) | |||
25 | { | 24 | { |
26 | foreach ($data['links'] as &$value) { | 25 | foreach ($data['links'] as &$value) { |
27 | if (!empty($value['tags']) && noMarkdownTag($value['tags'])) { | 26 | if (!empty($value['tags']) && noMarkdownTag($value['tags'])) { |
27 | $value['taglist'] = stripNoMarkdownTag($value['taglist']); | ||
28 | continue; | 28 | continue; |
29 | } | 29 | } |
30 | $value['description'] = process_markdown($value['description']); | 30 | $value['description'] = process_markdown($value['description']); |
31 | } | 31 | } |
32 | |||
33 | return $data; | 32 | return $data; |
34 | } | 33 | } |
35 | 34 | ||
@@ -44,6 +43,7 @@ function hook_markdown_render_feed($data) | |||
44 | { | 43 | { |
45 | foreach ($data['links'] as &$value) { | 44 | foreach ($data['links'] as &$value) { |
46 | if (!empty($value['tags']) && noMarkdownTag($value['tags'])) { | 45 | if (!empty($value['tags']) && noMarkdownTag($value['tags'])) { |
46 | $value['tags'] = stripNoMarkdownTag($value['tags']); | ||
47 | continue; | 47 | continue; |
48 | } | 48 | } |
49 | $value['description'] = process_markdown($value['description']); | 49 | $value['description'] = process_markdown($value['description']); |
@@ -87,6 +87,19 @@ function noMarkdownTag($tags) | |||
87 | } | 87 | } |
88 | 88 | ||
89 | /** | 89 | /** |
90 | * Remove the no-markdown meta tag so it won't be displayed. | ||
91 | * | ||
92 | * @param string $tags Tag list. | ||
93 | * | ||
94 | * @return string tag list without no markdown tag. | ||
95 | */ | ||
96 | function stripNoMarkdownTag($tags) | ||
97 | { | ||
98 | unset($tags[array_search(NO_MD_TAG, $tags)]); | ||
99 | return array_values($tags); | ||
100 | } | ||
101 | |||
102 | /** | ||
90 | * When link list is displayed, include markdown CSS. | 103 | * When link list is displayed, include markdown CSS. |
91 | * | 104 | * |
92 | * @param array $data includes data. | 105 | * @param array $data includes data. |