Skip to content

Commit

Permalink
Fix for underscore emphasis parsing when underscore is in middle of w…
Browse files Browse the repository at this point in the history
…ord, fixes #192
  • Loading branch information
gettalong committed Feb 4, 2015
1 parent b90cf4c commit 0a70cda
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/kramdown/parser/kramdown/emphasis.rb
Expand Up @@ -22,7 +22,7 @@ def parse_emphasis
element = (result.length == 2 ? :strong : :em)
type = result[0..0]

if (type == '_' && @src.pre_match =~ /[[:alnum:]]\z/ && @src.check(/[[:alnum:]]/)) || @src.check(/\s/) ||
if (type == '_' && @src.pre_match =~ /[[:alnum:]]\z/) || @src.check(/\s/) ||
@tree.type == element || @stack.any? {|el, _| el.type == element}
add_text(result)
return
Expand Down
2 changes: 2 additions & 0 deletions test/testcases/span/02_emphasis/normal.html
Expand Up @@ -44,3 +44,5 @@
Or this *<em>this</em>* way
Or that <em>*that</em>* way
Or that *<em>that*</em> way</p>

<p><a href="http://blah.com/blah_%28">http://blah.com/blah_%28</a></p>
2 changes: 2 additions & 0 deletions test/testcases/span/02_emphasis/normal.text
Expand Up @@ -44,3 +44,5 @@ Do it *\*this\** way
Or this \**this*\* way
Or that *\*that*\* way
Or that \**that\** way

[http://blah.com/blah_%28](http://blah.com/blah_%28)

0 comments on commit 0a70cda

Please sign in to comment.