https://github.com/mattecapu/react-markup-text
add <p>s and <br/>s to texts
https://github.com/mattecapu/react-markup-text
Last synced: 5 months ago
JSON representation
add <p>s and <br/>s to texts
- Host: GitHub
- URL: https://github.com/mattecapu/react-markup-text
- Owner: mattecapu
- Created: 2016-10-20T08:42:31.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-03-24T13:47:58.000Z (about 9 years ago)
- Last Synced: 2025-10-28T05:27:55.423Z (8 months ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# react-markup-text
### markup texts with React
Use this package to add paragraphs and line endings to unstructured text
## Install
```
npm install --save react-markup-text
```
## Usage
```js
import textToReactMarkup from 'react-markup-text';
function BlogArticle({ title, author, body }) {
return (
{title}
{textToReactMarkup(body)}
);
}
```
## API
#### `textToReactMarkup(text: string) : Array`
The implementation is really simple, `\n\n` creates a new paragraph and `\n` a new line.
## License
ISC