mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
Fix bug where empty atx headings would not be recognised (CommonMark)
Fixes #595
This commit is contained in:
parent
cf6d23de55
commit
772c919b05
@ -512,8 +512,6 @@ class Parsedown
|
|||||||
# Header
|
# Header
|
||||||
|
|
||||||
protected function blockHeader($Line)
|
protected function blockHeader($Line)
|
||||||
{
|
|
||||||
if (isset($Line['text'][1]))
|
|
||||||
{
|
{
|
||||||
$level = 1;
|
$level = 1;
|
||||||
|
|
||||||
@ -529,7 +527,7 @@ class Parsedown
|
|||||||
|
|
||||||
$text = trim($Line['text'], '#');
|
$text = trim($Line['text'], '#');
|
||||||
|
|
||||||
if ($this->strictMode and ( ! isset($text[0]) or $text[0] !== ' '))
|
if ($this->strictMode and isset($text[0]) and $text[0] !== ' ')
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -549,7 +547,6 @@ class Parsedown
|
|||||||
|
|
||||||
return $Block;
|
return $Block;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# List
|
# List
|
||||||
|
@ -6,7 +6,8 @@
|
|||||||
<h6>h6</h6>
|
<h6>h6</h6>
|
||||||
<p>####### not a heading</p>
|
<p>####### not a heading</p>
|
||||||
<h1>closed h1</h1>
|
<h1>closed h1</h1>
|
||||||
<p>#</p>
|
<h1></h1>
|
||||||
|
<h2></h2>
|
||||||
<h1># of levels</h1>
|
<h1># of levels</h1>
|
||||||
<h1># of levels #</h1>
|
<h1># of levels #</h1>
|
||||||
<h1>heading</h1>
|
<h1>heading</h1>
|
@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
#
|
#
|
||||||
|
|
||||||
|
##
|
||||||
|
|
||||||
# # of levels
|
# # of levels
|
||||||
|
|
||||||
# # of levels # #
|
# # of levels # #
|
||||||
|
Loading…
Reference in New Issue
Block a user