bvaughn / react-highlight-words

React component to highlight words within a larger body of text
https://bvaughn.github.io/react-highlight-words/
MIT License
2.16k stars 170 forks source link

textToHighlight with line breaks #74

Closed viebel closed 5 years ago

viebel commented 5 years ago

Is it possible to have end of line characters inside textToHighlight and to render them as end of line characters?

bvaughn commented 5 years ago

I don't understand. What would it mean to "render them as eol characters"? HTML ignores such characters.

I'll you have specific a "whitespace: pre" style or something.

viebel commented 5 years ago

The text I want to highlight contains end of line characters and I would like them to appear. I know that HTML ignore end of line characters. Is there a way to use react-highlight-words with a multi-line text?

What is the suggested way to

On Sun, Jan 6, 2019, 17:14 Brian Vaughn notifications@github.com wrote:

I don't understand. What would it mean to "render them as eol characters"? HTML ignores such characters.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bvaughn/react-highlight-words/issues/74#issuecomment-451749063, or mute the thread https://github.com/notifications/unsubscribe-auth/AA6VPoUCLFwx5e-a1cE5EmqPXwr_ZCwFks5vAhK7gaJpZM4Zydwb .

bvaughn commented 5 years ago

Use CSS to govern the the way the browser displays the whitespace:

.YourText {
  whitespace: pre
}

I don't think this question is really specific to this library so I'm going to close the GitHub issue. 😄

viebel commented 5 years ago

Awesome. Thank you

On Mon, Jan 7, 2019 at 6:26 PM Brian Vaughn notifications@github.com wrote:

Use CSS to govern the the way the browser displays the whitespace:

.YourText {

whitespace: pre

}

I don't think this question is really specific to this library so I'm going to close the GitHub issue. 😄

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bvaughn/react-highlight-words/issues/74#issuecomment-451992391, or mute the thread https://github.com/notifications/unsubscribe-auth/AA6VPj8P7RuIh5V72hjT7Iqfn8nx_P4Fks5vA3U6gaJpZM4Zydwb .

frontendjorge commented 5 years ago
whitespace

In react native isn't possible put whitespace as style.

frontendjorge commented 5 years ago

The text I want to highlight contains end of line characters and I would like them to appear. I know that HTML ignore end of line characters. Is there a way to use react-highlight-words with a multi-line text? What is the suggested way to On Sun, Jan 6, 2019, 17:14 Brian Vaughn @.***> wrote: I don't understand. What would it mean to "render them as eol characters"? HTML ignores such characters. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#74 (comment)>, or mute the thread https://github.com/notifications/unsubscribe-auth/AA6VPoUCLFwx5e-a1cE5EmqPXwr_ZCwFks5vAhK7gaJpZM4Zydwb .

Find the way for put large text with styles in textToHightlight?