Adapted from https://github.com/shaarli/Shaarli/pull/785
Signed-off-by: VirtualTam <virtualtam@flibidi.net>
$processedDescription = reverse_space2nbsp($processedDescription);
$processedDescription = unescape($processedDescription);
$processedDescription = $parsedown
- ->setMarkupEscaped(false)
+ ->setMarkupEscaped(true)
->setBreaksEnabled(true)
->text($processedDescription);
$processedDescription = sanitize_html($processedDescription);
$data = hook_markdown_render_daily($data);
$this->assertEquals($str, $data['cols'][0][0]['formatedDescription']);
}
+
+ /**
+ * Make sure that the HTML tags are escaped.
+ */
+ public function testMarkdownWithHtmlEscape()
+ {
+ $md = '**strong** <strong>strong</strong>';
+ $html = '<div class="markdown"><p><strong>strong</strong> <strong>strong</strong></p></div>';
+ $data = array(
+ 'links' => array(
+ 0 => array(
+ 'description' => $md,
+ ),
+ ),
+ );
+ $data = hook_markdown_render_linklist($data);
+ $this->assertEquals($html, $data['links'][0]['description']);
+ }
}