more || $this->from >= 0) return; $last = null; foreach(['/^(\={1,6})(.+)\={1,6}?$/m', '/^(\#{1,6})(.+)$/m'] as $pattern) if(preg_match($pattern, $string, $matches, PREG_OFFSET_CAPTURE) && ($last === null || $last > $matches[0][1])){ $this->from = $matches[0][1]; $this->matches = $matches; }; } public function process($string, $modules, $level){ $html = trim(\WMarkDown\Modules::format($this->wmarkdown, $this->matches[2][0], ["paragraphs"], $modules)["content"]); $i = $this->level + 1; $this->length = strlen($this->matches[0][0]); $this->to = $this->from + $this->length; $this->content = $html; $modules->menu_level = $this->level = strlen($this->matches[1][0]) + $level; $this->id = self::id($html); $this->html = '' . $html . ''; } public function get_id(){return "" . $this->id;} public function get_level(){return 0 | $this->level;} }