PluginProbe
OPcache Manager / 3.3.0
OPcache Manager v3.3.0
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.2.0 1.3.0 1.3.1 1.3.2 2.0.0 2.1.0 2.10.0 2.11.0 2.12.0 2.13.0 2.13.1 2.14.0 2.2.0 2.3.0 2.3.1 2.3.2 2.4.0 2.5.0 2.6.0 All 36 releases
opcache-manager / includes / libraries / markdown / block / RuleTrait.php

RuleTrait.php in OPcache Manager 3.3.0, at includes/libraries/markdown/block/RuleTrait.php

40 lines 811 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
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
6 */
7
8 namespace cebe\markdownparser\block;
9
10 /**
11 * Adds horizontal rules
12 */
13 trait RuleTrait
14 {
15 /**
16 * identify a line as a horizontal rule.
17 */
18 protected function identifyHr($line)
19 {
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);
22 }
23
24 /**
25 * Consume a horizontal rule
26 */
27 protected function consumeHr($lines, $current)
28 {
29 return [['hr'], $current];
30 }
31
32 /**
33 * Renders a horizontal rule
34 */
35 protected function renderHr($block)
36 {
37 return $this->html5 ? "<hr>\n" : "<hr />\n";
38 }
39
40 }