Fix bug where empty atx headings would not be recognised (CommonMark)

Fixes #595
This commit is contained in:
Aidan Woods 2018-04-02 17:09:54 +01:00
parent cf6d23de55
commit 772c919b05
No known key found for this signature in database
GPG Key ID: 9A6A8EFAA512BBB9
3 changed files with 35 additions and 35 deletions

View File

@ -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

View File

@ -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>

View File

@ -16,6 +16,8 @@
# #
##
# # of levels # # of levels
# # of levels # # # # of levels # #