helpers/ApiMarkdownTrait.php
protected function consumeQuote($lines, $current)
    {
        $block = parent::consumeQuote($lines, $current);

        $blockTypes = [
            'warning',
            'note',
            'info',
            'tip',
        ];

        // check whether this is a special Info, Note, Warning, Tip block
        $content = $block[0]['content'];
        $first = reset($content);
        if (isset($first[0]) && $first[0] === 'paragraph') {
            $parfirst = reset($first['content']);
            if (isset($parfirst[0]) && $parfirst[0] === 'text') {
                foreach ($blockTypes as $type) {
                    if (strncasecmp("$type: ", $parfirst[1], $len = strlen($type) + 2) === 0) {
                        // remove block indicator
                        $block[0]['content'][0]['content'][0][1] = substr($parfirst[1], $len);
                        // add translated block indicator as bold text
                        array_unshift($block[0]['content'][0]['content'], [
                            'strong',
                            [
                                ['text', $this->translateBlockType($type)],
                            ],
                        ]);
                        $block[0]['blocktype'] = $type;
                        break;
                    }
                }
            }
        }
        return $block;
    }
protected function consumeQuote($lines, $current)
    {
        $block = parent::consumeQuote($lines, $current);

        $blockTypes = [
            'warning',
            'note',
            'info',
            'tip',
        ];

        // check whether this is a special Info, Note, Warning, Tip block
        $content = $block[0]['content'];
        $first = reset($content);
        if (isset($first[0]) && $first[0] === 'paragraph') {
            $parfirst = reset($first['content']);
            if (isset($parfirst[0]) && $parfirst[0] === 'text') {
                foreach ($blockTypes as $type) {
                    if (strncasecmp("$type: ", $parfirst[1], $len = strlen($type) + 2) === 0) {
                        // remove block indicator
                        $block[0]['content'][0]['content'][0][1] = substr($parfirst[1], $len);
                        // add translated block indicator as bold text
                        array_unshift($block[0]['content'][0]['content'], [
                            'strong',
                            [
                                ['text', $this->translateBlockType($type)],
                            ],
                        ]);
                        $block[0]['blocktype'] = $type;
                        break;
                    }
                }
            }
        }
        return $block;
    }
protected function consumeQuote ( $ lines , $ current ) { $ block = parent :: consumeQuote ( $ lines , $ current ) ; $ blockTypes = [ 'warning' , 'note' , 'info' , 'tip' , ] ; // check whether this is a special Info, Note, Warning, Tip block $ content = $ block [ 0 ] [ 'content' ] ; $ first = reset ( $ content ) ; if ( isset ( $ first [ 0 ] ) && $ first [ 0 ] === 'paragraph' ) { $ parfirst = reset ( $ first [ 'content' ] ) ; if ( isset ( $ parfirst [ 0 ] ) && $ parfirst [ 0 ] === 'text' ) { foreach ( $ blockTypes as $ type ) { if ( strncasecmp ( "$type: " , $ parfirst [ 1 ] , $ len = strlen ( $ type ) + 2 ) === 0 ) { // remove block indicator $ block [ 0 ] [ 'content' ] [ 0 ] [ 'content' ] [ 0 ] [ 1 ] = substr ( $ parfirst [ 1 ] , $ len ) ; // add translated block indicator as bold text array_unshift ( $ block [ 0 ] [ 'content' ] [ 0 ] [ 'content' ] , [ 'strong' , [ [ 'text' , $ this -> translateBlockType ( $ type ) ] , ] , ] ) ; $ block [ 0 ] [ 'blocktype' ] = $ type ; break ; } } } } return $ block ; }
Consume lines for a blockquote element
Consume lines for a blockquote element