Cut out tags option (<img>...)
Closed this issue · 5 comments
I would like to have an option to cut out images, is there any way to do this?
Currently there is not, but it sounds like a useful thing to have, and which should have minimal effect on performance, so I'd happily accept a PR for it.
It'd be especially useful if it were implemented as a generic option that can be passed like so:
clip(htmlString, { maxLength: 140, stripTags: ["img", "b", /*...*/ })
Bonus points for also allowing stripTags: true
, which would simply strip all tags.
If you decide to create a PR, please create a few tests, and update the README to add documentation for it.
If you don't wish to create a PR, please just let me know, and this issue can remain open for me or someone to implement in the future. Thanks!
Sure I will test some things out to figure out a clean solution. I will let you know here if I had success. :)
Just wanted to say that I have to much work currently and I will not be able to take a look soon for this feature.
No worries, thanks for the update!
It was a bit tricker than I thought myself, but it's implemented in master
now.
Edit: Published as 2.2.0