Permalink
Browse files

Fixed code block as first element of a list item.

  • Loading branch information...
1 parent 4596f60 commit 79677f652b03348f1c82d8d4b8bb13c8a052f51b @michelf committed Mar 11, 2008
Showing with 4 additions and 1 deletion.
  1. +4 −1 markdown.php
View
@@ -994,7 +994,7 @@ function processListItems($list_str, $marker_any) {
$list_str = preg_replace_callback('{
(\n)? # leading line = $1
(^[ ]*) # leading whitespace = $2
- ('.$marker_any.') [ ]+ # list marker = $3
+ ('.$marker_any.' [ ]+) # list marker and space = $3
((?s:.+?)) # list item text = $4
(?:(\n+(?=\n))|\n) # tailing blank line = $5
(?= \n* (\z | \2 ('.$marker_any.') [ ]+))
@@ -1008,11 +1008,14 @@ function _processListItems_callback($matches) {
$item = $matches[4];
$leading_line =& $matches[1];
$leading_space =& $matches[2];
+ $marker_space = $matches[3];
$tailing_blank_line =& $matches[5];
if ($leading_line || $tailing_blank_line ||
preg_match('/\n{2,}/', $item))
{
+ # Replace marker with the appropriate whitespace indentation
+ $item = $leading_space . str_repeat(' ', strlen($marker_space)) . $item;
$item = $this->runBlockGamut($this->outdent($item)."\n");
}
else {

0 comments on commit 79677f6

Please sign in to comment.