src/MarkdownIt/Ruler.php
public function at($name, $entity, $options=null)
    {
        $index = $this->__find__($name);
        if( is_object($options) ) $opt = $options;
        else $opt = is_array($options) ? (object)$options : new \stdClass();

        if ($index === -1) { throw new \Exception('Parser rule not found: ' . $name); }

        $this->__rules__[$index]->setEntity($entity);
        $this->__rules__[$index]->alt = isset($opt->alt) ? $opt->alt : [];
        $this->__cache__ = null;
    }
public function at($name, $entity, $options=null)
    {
        $index = $this->__find__($name);
        if( is_object($options) ) $opt = $options;
        else $opt = is_array($options) ? (object)$options : new \stdClass();

        if ($index === -1) { throw new \Exception('Parser rule not found: ' . $name); }

        $this->__rules__[$index]->setEntity($entity);
        $this->__rules__[$index]->alt = isset($opt->alt) ? $opt->alt : [];
        $this->__cache__ = null;
    }
public function at ( $ name , $ entity , $ options = null ) { $ index = $ this -> __find__ ( $ name ) ; if ( is_object ( $ options ) ) $ opt = $ options ; else $ opt = is_array ( $ options ) ? ( object ) $ options : new \ stdClass ( ) ; if ( $ index === - 1 ) { throw new \ Exception ( 'Parser rule not found: ' . $ name ) ; } $ this -> __rules__ [ $ index ] -> setEntity ( $ entity ) ; $ this -> __rules__ [ $ index ] -> alt = isset ( $ opt -> alt ) ? $ opt -> alt : [ ] ; $ this -> __cache__ = null ; }
Replace rule by name with new function & options. Throws error if name not
found.

##### Options:

- __alt__ - array with names of "alternate" chains.

##### Example

Replace existing typographer replacement rule with new one:

```PHP
class Instance{
public property($state){...}
}
$md = new Mmarkdown-It();

$md->core->ruler->at('replacements', [new Instance(), 'property']);
// or
$md->core->ruler->at('replacements', function replace($state) {
//...
});
```
@param string        $name    rule name to replace.
@param callable|array  $entity    new rule function or instance.
@param object        $options new rule options (not mandatory).
Replace rule by name with new function & options . Throws error if name not found .