Last active
December 14, 2015 18:56
-
-
Save markshust/06d5380878fa7fc6d7bd to your computer and use it in GitHub Desktop.
underscore mixin to convert line breaks to br tags
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| _.mixin({ | |
| lbToBr: function(html) { | |
| html = html.replace(/(?:\r\n|\r|\n)/g, '<br />'); | |
| return html; | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment