diff --git a/lib/kramdown/parser/kramdown/emphasis.rb b/lib/kramdown/parser/kramdown/emphasis.rb index 011086fb..9cc1c43f 100644 --- a/lib/kramdown/parser/kramdown/emphasis.rb +++ b/lib/kramdown/parser/kramdown/emphasis.rb @@ -22,7 +22,7 @@ def parse_emphasis element = (result.length == 2 ? :strong : :em) type = result[0..0] - if (type == '_' && @src.pre_match =~ /[[:alpha:]]-?[[:alpha:]]*\z/) || @src.check(/\s/) || + if (type == '_' && @src.pre_match =~ /[[:alpha:]]-?[[:alpha:]]*_*\z/) || @src.check(/\s/) || @tree.type == element || @stack.any? {|el, _| el.type == element } add_text(result) return