diff --git a/Parsedown.php b/Parsedown.php index 1d9839b..5e4a6e2 100644 --- a/Parsedown.php +++ b/Parsedown.php @@ -505,7 +505,8 @@ class Parsedown return; } - $text = trim($Line['text'], '# '); + $text = trim($Line['text'], '#'); + $text = trim($text, ' '); $Block = array( 'element' => array( diff --git a/test/data/atx_heading.html b/test/data/atx_heading.html index 751f873..94c3825 100644 --- a/test/data/atx_heading.html +++ b/test/data/atx_heading.html @@ -6,4 +6,6 @@
h6

####### not a heading

closed h1

-

#

\ No newline at end of file +

#

+

# of levels

+

# of levels #

\ No newline at end of file diff --git a/test/data/atx_heading.md b/test/data/atx_heading.md index ad97b44..62fdd6c 100644 --- a/test/data/atx_heading.md +++ b/test/data/atx_heading.md @@ -14,4 +14,8 @@ # closed h1 # -# \ No newline at end of file +# + +# # of levels + +# # of levels # # \ No newline at end of file