PluginProbe
DecaLog / 4.4.0
DecaLog v4.4.0
3.0.2 3.1.0 3.10.0 3.2.0 3.3.0 3.4.0 3.4.1 3.5.0 3.5.1 3.6.0 3.6.1 3.6.2 3.6.3 3.7.0 3.7.1 3.8.0 3.9.0 3.9.1 4.0.0 4.1.0 4.2.0 4.3.0 4.3.1 4.4.0 4.5.0 All 75 releases
decalog / includes / libraries / markdown / inline / StrikeoutTrait.php

StrikeoutTrait.php in DecaLog 4.4.0, at includes/libraries/markdown/inline/StrikeoutTrait.php

41 lines 830 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\inline;
9
10 /**
11 * Adds strikeout inline elements
12 */
13 trait StrikeoutTrait
14 {
15 /**
16 * Parses the strikethrough feature.
17 * @marker ~~
18 */
19 protected function parseStrike($markdown)
20 {
21 if (preg_match('/^~~(.+?)~~/', $markdown, $matches)) {
22 return [
23 [
24 'strike',
25 $this->parseInline($matches[1])
26 ],
27 strlen($matches[0])
28 ];
29 }
30 return [['text', $markdown[0] . $markdown[1]], 2];
31 }
32
33 protected function renderStrike($block)
34 {
35 return '<del>' . $this->renderAbsy($block[1]) . '</del>';
36 }
37
38 abstract protected function parseInline($text);
39 abstract protected function renderAbsy($blocks);
40 }
41