I made a little improvement to ActionView::Helpers::TextHelper#truncate – added strip_tags: true option, to strip HTML tags in truncated text.
Once upon a time in a world far far away”)
Once upon a time in a wo…”
Once upon a time in a world far far away”, strip_tags: true)
=> “Once upon a time in a wo…”
I think this may be useful when truncating rich text, particularly when there are only annoying opening tags left after truncation.
Please, let me know what you think about it! Should I open pull request? I’m new to open source, this may be my first pr ever