src/MarkdownIt/MarkdownIt.php
public function enable($list, $ignoreInvalid=false)
    {
        $result = [];

        if (!is_array($list)) { $list = [ $list ]; }

        foreach ([ 'core', 'block', 'inline' ] as &$chain) {
            if( !property_exists($this,$chain) ) continue;
            $result = array_merge($result, $this->{$chain}->ruler->enable($list, true));
        }


        $result = array_merge($result, $this->inline->ruler2->enable($list, true) );

        $missed = array_filter ($list, function ($name) use(&$result) { return array_search ($name, $result) === false; });

        if (count($missed) !== 0 && !$ignoreInvalid) {
            throw new \Exception('MarkdownIt. Failed to enable unknown rule(s): ' . implode(', ', $missed));
        }

        return $this;
    }
public function enable($list, $ignoreInvalid=false)
    {
        $result = [];

        if (!is_array($list)) { $list = [ $list ]; }

        foreach ([ 'core', 'block', 'inline' ] as &$chain) {
            if( !property_exists($this,$chain) ) continue;
            $result = array_merge($result, $this->{$chain}->ruler->enable($list, true));
        }


        $result = array_merge($result, $this->inline->ruler2->enable($list, true) );

        $missed = array_filter ($list, function ($name) use(&$result) { return array_search ($name, $result) === false; });

        if (count($missed) !== 0 && !$ignoreInvalid) {
            throw new \Exception('MarkdownIt. Failed to enable unknown rule(s): ' . implode(', ', $missed));
        }

        return $this;
    }
public function enable ( $ list , $ ignoreInvalid = false ) { $ result = [ ] ; if ( ! is_array ( $ list ) ) { $ list = [ $ list ] ; } foreach ( [ 'core' , 'block' , 'inline' ] as & $ chain ) { if ( ! property_exists ( $ this , $ chain ) ) continue ; $ result = array_merge ( $ result , $ this -> { $ chain } -> ruler -> enable ( $ list , true ) ) ; } $ result = array_merge ( $ result , $ this -> inline -> ruler2 -> enable ( $ list , true ) ) ; $ missed = array_filter ( $ list , function ( $ name ) use ( & $ result ) { return array_search ( $ name , $ result ) === false ; } ) ; if ( count ( $ missed ) !== 0 && ! $ ignoreInvalid ) { throw new \ Exception ( 'MarkdownIt. Failed to enable unknown rule(s): ' . implode ( ', ' , $ missed ) ) ; } return $ this ; }
chainable
Enable list or rules. It will automatically find appropriate components,
containing rules with given names. If rule not found, and `ignoreInvalid`
not set - throws exception.

##### Example

```PHP
$md = new MarkdownIt();
$md->enable(['sub', 'sup'])
->disable('smartquotes');
```
@param string|array $list          rule name or list of rule names to enable
@param boolean      $ignoreInvalid set `true` to ignore errors when rule not found.
@return $this
chainable Enable list or rules . It will automatically find appropriate components containing rules with given names . If rule not found and ignoreInvalid not set - throws exception .