xijo/reverse_markdown — pull request #37 by danschultzer (2014-09-29 16:17:15+00:00)
Title: Proper handling of non breaking space

The parser is incorrect when handling text with a trailing inside emphasis such as . Browsers usually convert a trailing space into a HTML entity. However, it seems that nokogiri and reverse_markdown together converts it back to a space, which mess up the markdown.

Works well:
`ReverseMarkdown.convert 'feelings: '`
`=> " *feelings:* "`

Not valid markdown:
`ReverseMarkdown.convert 'feelings: '`
`=> " *feelings: * "`

I've added a cleanup method to handle this scenario and convert the UTF-8 non-breaking space into a . I think that is better than trimming it, as the seems to be intentional space to be shown.