lib/kramdown/parser/kramdown/paragraph.rb in kramdown-1.15.0 vs lib/kramdown/parser/kramdown/paragraph.rb in kramdown-1.16.0

- old
+ new

@@ -27,17 +27,24 @@ PARAGRAPH_MATCH = /^.*?\n/ PARAGRAPH_END = /#{LAZY_END}|#{DEFINITION_LIST_START}/ # Parse the paragraph at the current location. def parse_paragraph + pos = @src.pos start_line_number = @src.current_line_number result = @src.scan(PARAGRAPH_MATCH) while !@src.match?(paragraph_end) result << @src.scan(PARAGRAPH_MATCH) end result.rstrip! if @tree.children.last && @tree.children.last.type == :p - @tree.children.last.children.first.value << "\n" << result + last_item_in_para = @tree.children.last.children.last + if last_item_in_para && last_item_in_para.type == @text_type + joiner = (extract_string((pos - 3)...pos, @src) == " \n" ? " \n" : "\n") + last_item_in_para.value << joiner << result + else + add_text(result, @tree.children.last) + end else @tree.children << new_block_el(:p, nil, nil, :location => start_line_number) result.lstrip! add_text(result, @tree.children.last) end