npm stats
  • Search
  • About
  • Repo
  • Sponsor
  • more
    • Search
    • About
    • Repo
    • Sponsor

Made by Antonio Ramirez

newline-to-br

1.0.0

@yoshuawuyts

npmHomeRepoSnykSocket
Downloads:106
$ npm install newline-to-br
DailyWeeklyMonthlyYearly

newline-to-br

NPM version build status Test coverage Downloads

Format newlines to <br> tags. Supports linux, osx and windows newlines.

Installation

npm install newline-to-br

Usage

var toBr = require('newline-to-br');

toBr('This page cannot be displayed because \n your computer is currently offline');

// => 'This page cannot be displayed because <br> computer is currently offline'
br {
   display: block;
   margin: 0;
   padding: 0;
   border: none;
   content: " ";
}

@media only screen and (max-width: 475px) {
   br { display: none; }
}

Why?

Because by changing our newlines to <br> tags we can add custom styling which gives us finer-grained control over our text.

See also

  • breaking-text by max savin

License

MIT