russross / blackfriday

Blackfriday: a markdown processor for Go
Other
5.42k stars 598 forks source link

Inconsistent emChar handling when combined w/ non-breaking spaces #554

Open eykd opened 5 years ago

eykd commented 5 years ago

I've been noticing that Markdown emphasis characters (* and _) are not consistently rendered as <em>, and frequently come through as plain * and _.

I finally figured out that when copying Markdown out of Scrivener, for some reason it wraps emphasis characters with non-breaking spaces.

Here's a test-file:

test.txt

Not sure if it'll come through GH markdown, but here's the input:

A *test* with surrounding nbsp.

A *test*, with leading nbsp.

A *test* with trailing nbsp.

Another *test* without nbsp.

And here's the output:

$ blackfriday-tool test.txt
<p>A *test* with surrounding nbsp.</p>

<p>A <em>test</em>, with leading nbsp.</p>

<p>A *test* with trailing nbsp.</p>

<p>Another <em>test</em> without nbsp.</p>

And this is version 1.5 of blackfriday-tool:

$ blackfriday-tool --help
Blackfriday Markdown Processor v1.5
Available at http://github.com/russross/blackfriday