diff --git a/lib/bluefeather.rb b/lib/bluefeather.rb index a73cf5d..aa29498 100644 --- a/lib/bluefeather.rb +++ b/lib/bluefeather.rb @@ -1690,10 +1690,12 @@ module BlueFeather # Pattern to match strong emphasis in Markdown text - BoldRegexp = %r{ (\*\*|__) (\S|\S.*?\S) \1 }x + BoldRegexp1 = %r{ \*\* (\S|\S.*?\S) \*\* }x + BoldRegexp2 = %r{ (^|\s) __ (\S|\S.*?\S) __ (\s|$) }x # Pattern to match normal emphasis in Markdown text - ItalicRegexp = %r{ (\*|_) (\S|\S.*?\S) \1 }x + ItalicRegexp1 = %r{ \* (\S|\S.*?\S) \* }x + ItalicRegexp2 = %r{ (^|\s) _ (\S|\S.*?\S) _ (\s|$) }x ### Transform italic- and bold-encoded text in a copy of the specified +str+ ### and return it. @@ -1701,8 +1703,10 @@ module BlueFeather @log.debug " Transforming italic and bold" str. - gsub( BoldRegexp, %{\\2} ). - gsub( ItalicRegexp, %{\\2} ) + gsub( BoldRegexp1, %{\\1} ). + gsub( BoldRegexp2, %{\\2} ). + gsub( ItalicRegexp1, %{\\1} ). + gsub( ItalicRegexp2, %{\\1\\2\\3} ) end