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
|
||||
// extension
|
||||
elseif (isset($Element['unsafeHtml']) and !$this->safeMode)
|
||||
elseif (isset($Element['unsafeHtml']))
|
||||
{
|
||||
$text = $Element['unsafeHtml'];
|
||||
|
||||
$unsafeHtml = true;
|
||||
}
|
||||
|
||||
|
@ -60,11 +60,17 @@ class ParsedownTest extends TestCase
|
||||
{
|
||||
$markdown = "```php\nfoobar\n```";
|
||||
$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;
|
||||
$actualMarkup = $unsafeExtension->text($markdown);
|
||||
|
||||
$this->assertEquals($expectedMarkup, $actualMarkup);
|
||||
|
||||
$unsafeExtension->setSafeMode(true);
|
||||
$actualSafeMarkup = $unsafeExtension->text($markdown);
|
||||
|
||||
$this->assertEquals($expectedSafeMarkup, $actualSafeMarkup);
|
||||
}
|
||||
|
||||
function data()
|
||||
|
Loading…
Reference in New Issue
Block a user