leeoniya / reMarked.js

client-side HTML > markdown
http://leeoniya.github.io/reMarked.js/
396 stars 97 forks source link

Escape '_' #36

Closed ghost closed 10 years ago

ghost commented 10 years ago

**file_one file_two** gets converted to: \*\*file_one file_two\*\*

The * is escaped but not _

Some markdown editors will italicize "one file".

This isn't affecting me as of now but I think it's an interesting test case to consider.

leeoniya commented 10 years ago

the ambiguity in how various markdown parsers treat unescaped underscores is not really a concern for reMarked.

in html, all underscores are literal so i can escape them universally outside of code sections.

leeoniya commented 10 years ago

i tried escaping _ in my /tests documents, it created less readable markdown in many cases without a single instance of behaving in a beneficial fashion to italicize the middle of a word. perhaps this use case is more common in non-tech writing, where a literal underscore is plain wtf and the only use for underscores and asterisks is to style text.

the original markdown actually treats underscores and asterisks the same way so in theory you can still italicize the middle of a word by using asterisks: http://daringfireball.net/projects/markdown/syntax#em

i've decided to leave this alone and follow what github does, which i consider quite sensible. IMO it makes much more sense to leave "one file" alone and retain the underscores.