Created
January 12, 2017 18:13
-
-
Save NickWoodhams/5001075527688f7ab428780f25bf39ac to your computer and use it in GitHub Desktop.
Swap line break characters for div elements you can style. Useful for Displaying Textarea input values.
This file contains 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
def nl2lb(value): | |
return value.replace('\n', '<div class="line-break"></div>') | |
# Or even simpler | |
def nl2br(value): | |
return value.replace('\n', '<br>') |
This file contains 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
.line-break { | |
margin-bottom: 11px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment