evilstreak / markdown-js

A Markdown parser for javascript
7.7k stars 863 forks source link

Fix for issue #58 "Windows linebreak issues" #64

Closed matthewkastor closed 11 years ago

matthewkastor commented 11 years ago

Fix for issue #58 "Windows linebreak issues"

I installed markdown 0.4.0 through npm. While using md2html from the commandline on windows, I noticed that the program chokes on end of line marks that windows uses \r\n. I also noticed this same problem when using JSDoc3 which, has incorporated markdown-js into its source.

This pull request fixes the issue by replacing line breaks of the form \r\n, \n, and \r with the line break \n. I followed the process to the split_blocks function and inserted the filter on input text to occur just before it is processed. I believe this is the point in code that all input text has to pass through and that by affecting things here I've resolved the issue for all cases without introducing any bugs. Of course I could be wrong.

I commit these Glorious updates to make stuff do things, better!

RyanGough commented 11 years ago

+1 for this, would be great not to have to worry about line endings in markdown files

evilstreak commented 11 years ago

I included your fix in 67d8fee216a0a735569c357d95ad338297f712d8, along with some tests. Thanks for the patch.

matthewkastor commented 11 years ago

Awesome. :D