notslang / tidy-markdown

Beautify Markdown, fixing formatting mistakes and standardizing syntax
https://npmjs.com/package/tidy-markdown
GNU General Public License v3.0
75 stars 11 forks source link

*italic_text* converted to _italic_text_ on saving #35

Closed BuonOmo closed 8 years ago

BuonOmo commented 8 years ago

When I save something in italic using * char, I don’t really care about this changing to _. However sometimes it creates issues, like with this _simpleexample (github flavoured markdown fixes it as I see right now)! Maybe changing char should be an option, what do you think of it ?

notslang commented 8 years ago

I don't think that we should make the italic character into an option... We have a style-guide to base everything on and part of the goal behind this project is to reduce fragmentation in markdown usage.

However, I could see a case for selectively changing the character for sections of text that have an underscore in them, since a fair number of Markdown implementations handle it incorrectly: http://johnmacfarlane.net/babelmark2/?normalize=1&text=_italic_text_

BuonOmo commented 8 years ago

That would be nice, I may try to do it if you want. Where is the corresponding class in libs ?

notslang commented 8 years ago

Sure! https://github.com/slang800/tidy-markdown/blob/5dd622fde4fbecfd6672c8958fd5522c852be3e9/lib/converters.coffee#L75 is the part that handles italic text.

BuonOmo commented 8 years ago

Thank you. I’ll do it as soon as I have enough time to set a development environment!

BuonOmo commented 8 years ago

I just had an idea: if you want to keep underscore all the time, why not escape underscore inside ? like this:

_my_text_ -> _my\_text_

That would be an alternative. However, the PR I just made is about this change :

_my_text_ -> *my_text*

notslang commented 8 years ago

closed via #37