37 lines
1.3 KiB
Markdown
37 lines
1.3 KiB
Markdown
# br2nl
|
|
|
|
Yet another function to **replace HTML `<br>` tags with [newline characters](https://en.wikipedia.org/wiki/Newline)**.
|
|
|
|
*Note:* This package does *not* do [HTML sanitization](https://en.wikipedia.org/wiki/HTML_sanitization)! It merely replaces `<br>`.
|
|
|
|
[](https://www.npmjs.com/package/br2nl)
|
|
[](https://travis-ci.org/derhuerst/br2nl)
|
|

|
|
[](https://gitter.im/derhuerst)
|
|
[](https://patreon.com/derhuerst)
|
|
|
|
|
|
## Installation
|
|
|
|
```shell
|
|
npm install @derhuerst/br2nl
|
|
```
|
|
|
|
|
|
## Usage
|
|
|
|
```js
|
|
const br2nl = require('@derhuerst/br2nl')
|
|
|
|
console.log(br2nl('foo<br>bar'))
|
|
console.log(br2nl('foo<br> bar'))
|
|
console.log(br2nl('foo<br/>bar'))
|
|
console.log(br2nl('foo<br />bar'))
|
|
console.log(br2nl('foo<br a="b" />bar'))
|
|
```
|
|
|
|
|
|
## Contributing
|
|
|
|
If you have a question or need support using `br2nl`, please double-check your code and setup first. If you think you have found a bug or want to propose a feature, refer to [the issues page](https://github.com/derhuerst/br2nl/issues).
|