mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
Still grab the text if safe mode enabled, but output it escaped
This commit is contained in:
parent
e4c5be026d
commit
ef7ed7b66c
@ -1495,9 +1495,10 @@ class Parsedown
|
|||||||
}
|
}
|
||||||
// very strongly consider an alternative if you're writing an
|
// very strongly consider an alternative if you're writing an
|
||||||
// extension
|
// extension
|
||||||
elseif (isset($Element['unsafeHtml']) and !$this->safeMode)
|
elseif (isset($Element['unsafeHtml']))
|
||||||
{
|
{
|
||||||
$text = $Element['unsafeHtml'];
|
$text = $Element['unsafeHtml'];
|
||||||
|
|
||||||
$unsafeHtml = true;
|
$unsafeHtml = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,11 +60,17 @@ class ParsedownTest extends TestCase
|
|||||||
{
|
{
|
||||||
$markdown = "```php\nfoobar\n```";
|
$markdown = "```php\nfoobar\n```";
|
||||||
$expectedMarkup = '<pre><code class="language-php"><p>foobar</p></code></pre>';
|
$expectedMarkup = '<pre><code class="language-php"><p>foobar</p></code></pre>';
|
||||||
|
$expectedSafeMarkup = '<pre><code class="language-php"><p>foobar</p></code></pre>';
|
||||||
|
|
||||||
$unsafeExtension = new UnsafeExtension;
|
$unsafeExtension = new UnsafeExtension;
|
||||||
$actualMarkup = $unsafeExtension->text($markdown);
|
$actualMarkup = $unsafeExtension->text($markdown);
|
||||||
|
|
||||||
$this->assertEquals($expectedMarkup, $actualMarkup);
|
$this->assertEquals($expectedMarkup, $actualMarkup);
|
||||||
|
|
||||||
|
$unsafeExtension->setSafeMode(true);
|
||||||
|
$actualSafeMarkup = $unsafeExtension->text($markdown);
|
||||||
|
|
||||||
|
$this->assertEquals($expectedSafeMarkup, $actualSafeMarkup);
|
||||||
}
|
}
|
||||||
|
|
||||||
function data()
|
function data()
|
||||||
|
Loading…
Reference in New Issue
Block a user