lib/kramdown/parser/kramdown/header.rb in kramdown-2.1.0 vs lib/kramdown/parser/kramdown/header.rb in kramdown-2.2.0
- old
+ new
@@ -29,10 +29,10 @@
# Parse the Atx header at the current location.
def parse_atx_header
return false unless after_block_boundary?
text, id = parse_header_contents
- text.sub!(/[\t ]#+\z/, '') && text.rstrip!
+ text.sub!(/(?<!\\)#+\z/, '') && text.rstrip!
return false if text.empty?
add_header(@src["level"].length, text, id)
true
end
define_parser(:atx_header, ATX_HEADER_START)