My website contains bootstrap popovers with HTML code. Such a popover looks like this (instead of the popup HTML, I've put in a placeholder for readability):
<mark data-content="Fancy HTML here" data-html="true" data-toggle="popover">
This mark has a popover
</mark>
Inserting real HTML in the data-content
brings up the problem of escaping quotes properly. I found this question, which looks like an exact duplicate:
How do I encode html for Bootstrap popover and tooltip content
The accepted answer recommends to escape quotes to "
This doesn't work, the escaped quotes are not parsed properly. I've set up an example in this fiddle: https://jsfiddle.net/z4t2sud3/3/
Another option is to use single quotes '
for strings inside the popup. This option is also in the fiddle and it works properly.
But what if I want to nest deeper? For example, the HTML that I insert into the data-content
could contain popovers, too. While this seems like a very bad design idea, it would be nice to make it work.
Here is a fiddle for the double-nested popover: https://jsfiddle.net/cwz3sayj/3/