Fix emphasis escape sequence detection

Fixes issues #214 and #369