Skip to content

Commit

Permalink
Fix emphasis tests with multiple underscores wrongly converted
Browse files Browse the repository at this point in the history
When underscores are used inside words, they must not be converted to
elements. This change fixes the case where multiple underscores are
used, e.g. `this___isa___test`.
  • Loading branch information
gettalong committed Mar 20, 2023
1 parent dc2952b commit 0c34301
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/kramdown/parser/kramdown/emphasis.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0c34301

Please sign in to comment.