From 1c52cb6b5e775ce51c1c17ee211a2a484ff77766 Mon Sep 17 00:00:00 2001 From: Aidan Woods Date: Tue, 27 Mar 2018 22:01:32 +0100 Subject: [PATCH 1/2] Add failing test cases --- test/data/atx_heading.html | 4 +++- test/data/atx_heading.md | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) 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 From 790aed42ab4997d6c5889be6aa42820de0f0f980 Mon Sep 17 00:00:00 2001 From: Aidan Woods Date: Tue, 27 Mar 2018 22:04:11 +0100 Subject: [PATCH 2/2] Fix trimming of internal #'s --- Parsedown.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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(