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:
3636 (#731 ).
3737* Double escaping of block code has been eliminated (#725 ).
3838* 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):
445445 """ Process Hash Headers. """
446446
447447 # 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|$)' )
449449
450450 def test (self , parent , block ):
451451 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):
708708 """
709709 )
710710 )
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