Markdown: Add the 'meta-tag' .nomarkdown which prevent a shaare from being parsed with markdown

Also add the tag in tag list in edit_link, so it will appear on autocompletion.
This commit is contained in:
ArthurHoaro 2016-03-21 18:46:34 +01:00
parent 890afc32f7
commit 3ce20d9e84
2 changed files with 66 additions and 1 deletions

View file

@ -102,7 +102,8 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase
/**
* Test sanitize_html().
*/
function testSanitizeHtml() {
function testSanitizeHtml()
{
$input = '< script src="js.js"/>';
$input .= '< script attr>alert(\'xss\');</script>';
$input .= '<style> * { display: none }</style>';
@ -114,4 +115,38 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase
$input = escape($input);
$this->assertEquals($input, sanitize_html($input));
}
/**
* Test the no markdown tag.
*/
function testNoMarkdownTag()
{
$str = 'All _work_ and `no play` makes Jack a *dull* boy.';
$data = array(
'links' => array(array(
'description' => $str,
'tags' => NO_MD_TAG
))
);
$data = hook_markdown_render_linklist($data);
$this->assertEquals($str, $data['links'][0]['description']);
$data = array(
// Columns data
'cols' => array(
// First, second, third.
0 => array(
// nth link
0 => array(
'formatedDescription' => $str,
'tags' => NO_MD_TAG
),
),
),
);
$data = hook_markdown_render_daily($data);
$this->assertEquals($str, $data['cols'][0][0]['formatedDescription']);
}
}