3 * @copyright Copyright (c) 2014 Carsten Brandt
4 * @license https://github.com/cebe/markdown/blob/master/LICENSE
5 * @link https://github.com/cebe/markdown#readme
8 namespace cebe\markdown\block;
11 * Adds horizontal rules
16 * identify a line as a horizontal rule.
18 protected function identifyHr($line)
20 // at least 3 of -, * or _ on one line make a hr
21 return (($l = $line[0]) === ' ' || $l === '-' || $l === '*' || $l === '_') && preg_match('/^ {0,3}([\-\*_])\s*\1\s*\1(\1|\s)*$/', $line);
25 * Consume a horizontal rule
27 protected function consumeHr($lines, $current)
29 return [['hr'], $current];
33 * Renders a horizontal rule
35 protected function renderHr($block)
37 return $this->html5 ? "<hr>\n" : "<hr />\n";