src/MarkdownIt/Plugins/MarkdownItForInline.php
public function plugin($md, $ruleName, $tokenType, $iteartor)
    {
        $scan = function($state) use($md, $ruleName, $tokenType, $iteartor) {
            for ($blkIdx = count($state->tokens) - 1; $blkIdx >= 0; $blkIdx--) {
                if ($state->tokens[$blkIdx]->type !== 'inline') {
                    continue;
                }

                $inlineTokens = $state->tokens[$blkIdx]->children;

                for ($i = count($inlineTokens) - 1; $i >= 0; $i--) {
                    if ($inlineTokens[$i]->type !== $tokenType) {
                        continue;
                    }

                    $iteartor($inlineTokens, $i);
                }
            }
        };

        $md->core->ruler->push($ruleName, $scan);
    }
public function plugin($md, $ruleName, $tokenType, $iteartor)
    {
        $scan = function($state) use($md, $ruleName, $tokenType, $iteartor) {
            for ($blkIdx = count($state->tokens) - 1; $blkIdx >= 0; $blkIdx--) {
                if ($state->tokens[$blkIdx]->type !== 'inline') {
                    continue;
                }

                $inlineTokens = $state->tokens[$blkIdx]->children;

                for ($i = count($inlineTokens) - 1; $i >= 0; $i--) {
                    if ($inlineTokens[$i]->type !== $tokenType) {
                        continue;
                    }

                    $iteartor($inlineTokens, $i);
                }
            }
        };

        $md->core->ruler->push($ruleName, $scan);
    }
public function plugin ( $ md , $ ruleName , $ tokenType , $ iteartor ) { $ scan = function ( $ state ) use ( $ md , $ ruleName , $ tokenType , $ iteartor ) { for ( $ blkIdx = count ( $ state -> tokens ) - 1 ; $ blkIdx >= 0 ; $ blkIdx -- ) { if ( $ state -> tokens [ $ blkIdx ] -> type !== 'inline' ) { continue ; } $ inlineTokens = $ state -> tokens [ $ blkIdx ] -> children ; for ( $ i = count ( $ inlineTokens ) - 1 ; $ i >= 0 ; $ i -- ) { if ( $ inlineTokens [ $ i ] -> type !== $ tokenType ) { continue ; } $ iteartor ( $ inlineTokens , $ i ) ; } } } ; $ md -> core -> ruler -> push ( $ ruleName , $ scan ) ; }
MarkdownItForInline constructor.
@param \Kaoken\MarkdownIt\MarkdownIt $md
@param string   $ruleName
@param string   $tokenType
@param callable   $iteartor
MarkdownItForInline constructor .