Skip to content

Commit

Permalink
Bug Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
taufik-nurrohman committed Apr 8, 2024
1 parent 6932b9c commit 65f9174
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions index.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
<?php

namespace x {
function markdown_filter(?string $content, callable $fn): ?string {

}
}

namespace x\markdown_filter {
function row(?string $content, callable $fn): ?string {
if ("" === ($content = (string) $content)) {
Expand Down Expand Up @@ -61,13 +55,13 @@ function split(string $content) {
$chops[] = [$m[0], 0];
continue;
}
// <https://spec.commonmark.org/0.30#raw-html>
// <https://spec.commonmark.org/0.31.2#raw-html>
if (\preg_match('/^<\/[a-z][a-z\d-]*\s*>/i', $chop, $m)) {
$content = \substr($content, \strlen($m[0]));
$chops[] = [$m[0], 0];
continue;
}
// <https://spec.commonmark.org/0.30#raw-html>
// <https://spec.commonmark.org/0.31.2#raw-html>
if (\preg_match('/^<[a-z][a-z\d-]*(?>\s+[a-z:_][\w.:-]*(?>\s*=\s*(?>"[^"]*"|\'[^\']*\'|[^\s"\'<=>`]+)?)?)*\s*\/?>/i', $chop, $m)) {
$content = \substr($content, \strlen($m[0]));
$chops[] = [$m[0], 0];
Expand Down Expand Up @@ -524,6 +518,13 @@ function split(string $content) {
}
// Start of a tight list block
if (_list($row)) {
if (_list_b($row) && 1 === \strspn($row, '0123456789')) {
// <https://spec.commonmark.org/0.31.2#example-304>
if ('1' !== $row[0]) {
$blocks[$block][0] .= "\n" . $prefix . $row;
continue;
}
}
$blocks[++$block] = [$prefix . $row, 2];
continue;
}
Expand Down

0 comments on commit 65f9174

Please sign in to comment.