$value = stripNoMarkdownTag($value);
continue;
}
+ $value['description_src'] = $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;
$data = hook_markdown_render_linklist($data, $this->conf);
$this->assertNotFalse(strpos($data['links'][0]['description'], '<h1>'));
$this->assertNotFalse(strpos($data['links'][0]['description'], '<p>'));
+
+ $this->assertEquals($markdown, $data['links'][0]['description_src']);
}
/**
$this->assertEquals($text, $reversedText);
}
+ /**
+ * Test reverse_text2clickable().
+ */
+ public function testReverseText2clickableHashtags()
+ {
+ $text = file_get_contents('tests/plugins/resources/hashtags.raw');
+ $md = file_get_contents('tests/plugins/resources/hashtags.md');
+ $clickableText = hashtag_autolink($text);
+ $reversedText = reverse_text2clickable($clickableText);
+ $this->assertEquals($md, $reversedText);
+ }
+
/**
* Test reverse_nl2br().
*/
$this->conf->get('security.markdown_escape', true),
$this->conf->get('security.allowed_protocols')
);
- $this->assertEquals($html, $data);
+ $this->assertEquals($html, $data . PHP_EOL);
}
/**