| @@ 38-44 (lines=7) @@ | ||
| 35 | $fence = substr($line, 0, $pos = strrpos($line, $line[0]) + 1); |
|
| 36 | $language = substr($line, $pos); |
|
| 37 | $content = []; |
|
| 38 | for ($i = $current + 1, $count = count($lines); $i < $count; $i++) { |
|
| 39 | if (rtrim($line = $lines[$i]) !== $fence) { |
|
| 40 | $content[] = $line; |
|
| 41 | } else { |
|
| 42 | break; |
|
| 43 | } |
|
| 44 | } |
|
| 45 | $block = [ |
|
| 46 | 'code', |
|
| 47 | 'content' => implode("\n", $content), |
|
| @@ 83-89 (lines=7) @@ | ||
| 80 | { |
|
| 81 | $content = []; |
|
| 82 | if (strncmp($lines[$current], '<!--', 4) === 0) { // html comment |
|
| 83 | for ($i = $current, $count = count($lines); $i < $count; $i++) { |
|
| 84 | $line = $lines[$i]; |
|
| 85 | $content[] = $line; |
|
| 86 | if (strpos($line, '-->') !== false) { |
|
| 87 | break; |
|
| 88 | } |
|
| 89 | } |
|
| 90 | } else { |
|
| 91 | $tag = rtrim(substr($lines[$current], 1, min(strpos($lines[$current], '>'), strpos($lines[$current] . ' ', ' ')) - 1), '/'); |
|
| 92 | $level = 0; |
|
| @@ 119-125 (lines=7) @@ | ||
| 116 | $fence = substr($line, 0, $pos + 1); |
|
| 117 | $block['attributes'] = substr($line, $pos); |
|
| 118 | $content = []; |
|
| 119 | for($i = $current + 1, $count = count($lines); $i < $count; $i++) { |
|
| 120 | if (rtrim($line = $lines[$i]) !== $fence) { |
|
| 121 | $content[] = $line; |
|
| 122 | } else { |
|
| 123 | break; |
|
| 124 | } |
|
| 125 | } |
|
| 126 | $block['content'] = implode("\n", $content); |
|
| 127 | return [$block, $i]; |
|
| 128 | } |
|