Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

textToHighlight Prop doesn't maintain the spacing or newlines #80

Open
julianaubrey opened this issue Apr 25, 2019 · 2 comments
Open

textToHighlight Prop doesn't maintain the spacing or newlines #80

julianaubrey opened this issue Apr 25, 2019 · 2 comments

Comments

@julianaubrey
Copy link

The text I'm passing to the textToHighlight prop contains newlines because it is formatted in paragraphs. Unfortunately, the spacing or newlines are not maintained so my text doesn't look formatted anymore.

@rrfeng
Copy link

rrfeng commented Apr 26, 2019

+1 for spaces and newlines.

@MarkosKon
Copy link

You can use the white-space css property with the pre-wrap value.

For example, white-space: pre-wrap;.

You can pass it as a style prop in the Highlighter component.

Codesandbox example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants