1
0
mirror of https://github.com/erusev/parsedown.git synced 2023-08-10 21:13:06 +03:00
parsedown/tests/SampleExtensions/TrustDelegatedExtension.php

26 lines
817 B
PHP
Raw Normal View History

<?php
2018-04-17 16:44:38 +03:00
namespace Erusev\Parsedown\Tests\SampleExtensions;
2018-04-17 16:44:38 +03:00
use Erusev\Parsedown\Tests\TestParsedown;
2018-04-17 16:44:38 +03:00
class TrustDelegatedExtension extends TestParsedown
{
protected function blockFencedCodeComplete($Block)
{
$text = $Block['element']['element']['text'];
unset($Block['element']['element']['text']);
// WARNING: There is almost always a better way of doing things!
//
2018-03-15 22:55:33 +03:00
// This behaviour is NOT needed in the demonstrated case.
// Only use this if you are sure that the result being added into
// rawHtml is safe.
// (e.g. using an external parser with escaping capabilities).
$Block['element']['element']['rawHtml'] = "<p>$text</p>";
$Block['element']['element']['allowRawHtmlInSafeMode'] = true;
return $Block;
}
}