protected function blockFencedCode($line)
    {
        $regex = '/^([' . $line[ 'text' ][ 0 ] . ']{3,})[ ]*([\w-]+)?[ ]*$/';

        if (preg_match($regex, $line[ 'text' ], $matches)) {
            $element = [
                'name' => 'code',
                'text' => '',
            ];

            if (isset($matches[ 2 ])) {
                $class = $this->getConfig('fenced_code_lang_class', 'prettyprint lang-{LANG}');
                $class = str_replace('{LANG}', $matches[2], $class); //'prettyprint lang-' . $matches[ 2 ];

                $element[ 'attributes' ] = [ 'class' => $class ];
            }

            $block = [
                'char'    => $line[ 'text' ][ 0 ],
                'element' => [
                    'name'    => 'pre',
                    'handler' => 'element',
                    'text'    => $element,
                ],
            ];

            return $block;
        }
    }
protected function blockFencedCode($line)
    {
        $regex = '/^([' . $line[ 'text' ][ 0 ] . ']{3,})[ ]*([\w-]+)?[ ]*$/';

        if (preg_match($regex, $line[ 'text' ], $matches)) {
            $element = [
                'name' => 'code',
                'text' => '',
            ];

            if (isset($matches[ 2 ])) {
                $class = $this->getConfig('fenced_code_lang_class', 'prettyprint lang-{LANG}');
                $class = str_replace('{LANG}', $matches[2], $class); //'prettyprint lang-' . $matches[ 2 ];

                $element[ 'attributes' ] = [ 'class' => $class ];
            }

            $block = [
                'char'    => $line[ 'text' ][ 0 ],
                'element' => [
                    'name'    => 'pre',
                    'handler' => 'element',
                    'text'    => $element,
                ],
            ];

            return $block;
        }
    }
protected function blockFencedCode ( $ line ) { $ regex = '/^([' . $ line [ 'text' ] [ 0 ] . ']{3,})[ ]*([\w-]+)?[ ]*$/' ; if ( preg_match ( $ regex , $ line [ 'text' ] , $ matches ) ) { $ element = [ 'name' => 'code' , 'text' => '' , ] ; if ( isset ( $ matches [ 2 ] ) ) { $ class = $ this -> getConfig ( 'fenced_code_lang_class' , 'prettyprint lang-{LANG}' ) ; $ class = str_replace ( '{LANG}' , $ matches [ 2 ] , $ class ) ; //'prettyprint lang-' . $matches[ 2 ]; $ element [ 'attributes' ] = [ 'class' => $ class ] ; } $ block = [ 'char' => $ line [ 'text' ] [ 0 ] , 'element' => [ 'name' => 'pre' , 'handler' => 'element' , 'text' => $ element , ] , ] ; return $ block ; } }
Parse fenced code blocks.

@param array $line
@return array
Parse fenced code blocks .