You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for the work on this library. However, recently I noticed an issue where the truncation was failing and causing strange results. After some investigation, it was happening when the text contained a new line character - \n - and stripHTML: true, also lines: 2.
Example input:
This is a long line, it will cause things to start to wrap at some point, what is really happening though
This is a short line.
Output
p This is a long line, it will cause things to start to wrap at wra
I tried to trace the issue a bit and it seems like it's related to https://github.com/rviscomi/trunk8/blob/master/trunk8.js#L54 or #29. The new line character causes the HTML tags to not be properly open and closed. As a result, the stripped tag gets inserted into the truncated result.
My workaround fix was to strip any \n characters before passing the input to trunk8.
Thanks!
The text was updated successfully, but these errors were encountered:
Thanks @dorilla. I no longer have access to the code where this issue was occurring, so I can't verify. However, it seems like a good step in the right direction 👍
Thanks for the work on this library. However, recently I noticed an issue where the truncation was failing and causing strange results. After some investigation, it was happening when the text contained a new line character -
\n
- andstripHTML: true
, alsolines: 2
.Example input:
Output
I tried to trace the issue a bit and it seems like it's related to https://github.com/rviscomi/trunk8/blob/master/trunk8.js#L54 or #29. The new line character causes the HTML tags to not be properly open and closed. As a result, the stripped tag gets inserted into the truncated result.
My workaround fix was to strip any
\n
characters before passing the input to trunk8.Thanks!
The text was updated successfully, but these errors were encountered: