Doesn't work with <img /> tags, somehow
Opened this issue · 2 comments
rlipscombe commented
var t = require('html-truncate');
t('<ul><li><img src="image-1" /><img src="image-2" /></li></ul>', 40);
...returns
<ul><li><img src="image-2" /><img src="image-2" />
...rather than anything sensible.
Moreover, increasing the requested length doesn't fix it (passing 1000 instead of 40) gives the same result.
rlipscombe commented
So, thinking it might be a problem with the <img />
, rather than <img>
, I tried the following:
t('<ul><li><img src="image-1"><img src="image-2"></li></ul>', 1000);
...which returns:
<ul><li><img src="image-2"></li></ul></li></ul>
...which is still wrong. Where did the first image go?
orourkedd commented
I had the same problem, but with <br>
tags. The issue seems to be that its trying to close the tags. For example, this:
<br>test
becomes:
<br>tes</br>