File tree Expand file tree Collapse file tree 3 files changed +22
-1
lines changed Expand file tree Collapse file tree 3 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -36,3 +36,4 @@ The following bug fixes are included in the 3.1 release:
36
36
(#731 ).
37
37
* Double escaping of block code has been eliminated (#725 ).
38
38
* Problems with newlines in references has been fixed (#742 ).
39
+ * Escaped ` # ` are now handled in header syntax (#762 ).
Original file line number Diff line number Diff line change @@ -445,7 +445,7 @@ class HashHeaderProcessor(BlockProcessor):
445
445
""" Process Hash Headers. """
446
446
447
447
# Detect a header at start of any line in block
448
- RE = re .compile (r'(^|\n)(?P<level>#{1,6})(?P<header>. *?)#*(\n|$)' )
448
+ RE = re .compile (r'(?: ^|\n)(?P<level>#{1,6})(?P<header>(?:\\.|[^\\]) *?)#*(?: \n|$)' )
449
449
450
450
def test (self , parent , block ):
451
451
return bool (self .RE .search (block ))
Original file line number Diff line number Diff line change @@ -708,3 +708,23 @@ def test_p_followed_by_hash(self):
708
708
"""
709
709
)
710
710
)
711
+
712
+ def test_escaped_hash (self ):
713
+ self .assertMarkdownRenders (
714
+ "### H3 \\ ###" ,
715
+ self .dedent (
716
+ """
717
+ <h3>H3 #</h3>
718
+ """
719
+ )
720
+ )
721
+
722
+ def test_unescaped_hash (self ):
723
+ self .assertMarkdownRenders (
724
+ "### H3 \\ \\ ###" ,
725
+ self .dedent (
726
+ """
727
+ <h3>H3 \\ </h3>
728
+ """
729
+ )
730
+ )
You can’t perform that action at this time.
0 commit comments