markdown compatibility

This commit is contained in:
Mike Macgirvin 2024-05-28 10:25:07 +10:00
parent f241cac234
commit 05d6785afd
2 changed files with 2 additions and 4 deletions

View file

@ -93,8 +93,6 @@ This is an example of `inline code`.
[h3]Lists[/h3]
In order to reduce "false positives", markdown lists are only rendered if they contain more than one list element within the entire content body.
As with bold and italic, the first character of an unordered list may be preceded by a backslash or wrapped in [nobb][nomd][/nomd][/nobb] tags to prevent normal text lines beginning with these characters from being interpreted as a list.

View file

@ -2209,11 +2209,11 @@ function bbcode($Text, $options = [])
// unordered lists
$matches = [];
// Ignore if there is only one list element as it could be a false positive.
if (preg_match_all('#^(?<!\\\)[*\-+] +(.*?)$#m', $Text, $matches, PREG_SET_ORDER) && count($matches) > 1) {
// if (preg_match_all('#^(?<!\\\)[*\-+] +(.*?)$#m', $Text, $matches, PREG_SET_ORDER) && count($matches) > 1) {
$Text = preg_replace('#^(?<!\\\)[*\-+] +(.*?)$#m', '<ul><li>$1</li></ul>', $Text);
// strip the backslash escape if present
$Text = preg_replace('#^(\\\)([*\-+]) #m', '$2', $Text);
}
// }
// order lists
$Text = preg_replace('#^(?<!\\\)(\d+[\.\)]) +(.*?)$#m', '<ol><li value="$1">$2</li></ol>', $Text);
$Text = preg_replace('#^(\\\)(\d+[\.\)])#m', '$2', $Text);