This commit is contained in:
Bruno Pitteli Gonçalves 2020-08-19 22:31:36 +02:00 committed by GitHub
commit c0bb07f80c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 1 deletions

View File

@ -13,12 +13,15 @@
#
#
class Parsedown
class Parsedown
{
# ~
const version = '1.8.0-beta-7';
# ~
protected $texthook = NULL;
# ~
function text($text)
@ -1720,6 +1723,11 @@ class Parsedown
$permitRawHtml = false;
// Add a hook for change blocks on the fly
if(is_callable($this->texthook)) {
$Element = call_user_func($this->texthook, $Element);
}
if (isset($Element['text']))
{
$text = $Element['text'];
@ -1750,6 +1758,8 @@ class Parsedown
}
else
{
if (!$permitRawHtml)
{
$markup .= self::escape($text, true);
@ -1770,6 +1780,13 @@ class Parsedown
return $markup;
}
/**
* Set callback hool
*/
public function setTextHook($callback) {
$this->texthook = $callback;
}
protected function elements(array $Elements)
{
$markup = '';