Allow parsedown to specify list start attribute
Remove github added tabs on blank lines
This commit is contained in:
parent
a37797ef34
commit
3978e33fd0
|
@ -503,7 +503,7 @@ class Parsedown
|
||||||
protected function blockList($Line)
|
protected function blockList($Line)
|
||||||
{
|
{
|
||||||
list($name, $pattern) = $Line['text'][0] <= '-' ? array('ul', '[*+-]') : array('ol', '[0-9]+[.]');
|
list($name, $pattern) = $Line['text'][0] <= '-' ? array('ul', '[*+-]') : array('ol', '[0-9]+[.]');
|
||||||
|
|
||||||
if (preg_match('/^('.$pattern.'[ ]+)(.*)/', $Line['text'], $matches))
|
if (preg_match('/^('.$pattern.'[ ]+)(.*)/', $Line['text'], $matches))
|
||||||
{
|
{
|
||||||
$Block = array(
|
$Block = array(
|
||||||
|
@ -514,7 +514,7 @@ class Parsedown
|
||||||
'handler' => 'elements',
|
'handler' => 'elements',
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
if($name === 'ol')
|
if($name === 'ol')
|
||||||
{
|
{
|
||||||
$listStart = stristr($matches[0], ".", true);
|
$listStart = stristr($matches[0], ".", true);
|
||||||
|
@ -523,7 +523,7 @@ class Parsedown
|
||||||
$Block['element']['attributes'] = array('start' => $listStart);
|
$Block['element']['attributes'] = array('start' => $listStart);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$Block['li'] = array(
|
$Block['li'] = array(
|
||||||
'name' => 'li',
|
'name' => 'li',
|
||||||
'handler' => 'li',
|
'handler' => 'li',
|
||||||
|
@ -531,9 +531,9 @@ class Parsedown
|
||||||
$matches[2],
|
$matches[2],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
$Block['element']['text'] []= & $Block['li'];
|
$Block['element']['text'] []= & $Block['li'];
|
||||||
|
|
||||||
return $Block;
|
return $Block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue