calebjacob / tooltipster

A jQuery tooltip plugin
MIT License
2.76k stars 480 forks source link

New lines and spaces aren't shown #766

Closed pbelskiy closed 5 years ago

pbelskiy commented 5 years ago

Hello.

I format hint on backend (Django), and for example hint is:

"""test:\n a: 1\n b: 2"""

Why are spaces and new lines aren't shown?

I know that I can use contentAsHTML: true option in JS library initialization, but I also have to use such replaces on backend: .replace("\n", "<br>").replace(" ", "&nbsp;")

Is there easy way to fix it?

louisameline commented 5 years ago

Hi, no. New lines must be done in html in a page. You can do your replace in the browser rather than in the backend if you want, but you still need a br/ in the end.