mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
3fc54bc966
Rename "unsafeHtml" to "rawHtml"
40 lines
1.3 KiB
PHP
40 lines
1.3 KiB
PHP
<?php
|
|
|
|
class UnsafeExtension extends Parsedown
|
|
{
|
|
protected function blockFencedCodeComplete($Block)
|
|
{
|
|
$text = $Block['element']['text']['text'];
|
|
unset($Block['element']['text']['text']);
|
|
|
|
// WARNING: There is almost always a better way of doing things!
|
|
//
|
|
// This example is one of them, unsafe behaviour is NOT needed here.
|
|
// Only use this if you trust the input and have no idea what
|
|
// the output HTML will look like (e.g. using an external parser).
|
|
$Block['element']['text']['rawHtml'] = "<p>$text</p>";
|
|
|
|
return $Block;
|
|
}
|
|
}
|
|
|
|
|
|
class TrustDelegatedExtension extends Parsedown
|
|
{
|
|
protected function blockFencedCodeComplete($Block)
|
|
{
|
|
$text = $Block['element']['text']['text'];
|
|
unset($Block['element']['text']['text']);
|
|
|
|
// WARNING: There is almost always a better way of doing things!
|
|
//
|
|
// This example is one of them, unsafe behaviour is NOT needed here.
|
|
// Only use this if you trust the input and have no idea what
|
|
// the output HTML will look like (e.g. using an external parser).
|
|
$Block['element']['text']['rawHtml'] = "<p>$text</p>";
|
|
$Block['element']['text']['allowRawHtmlInSafeMode'] = true;
|
|
|
|
return $Block;
|
|
}
|
|
}
|