Description of the need

People are often frustrated when they expect 600 characters of text, and get far fewer because their post contained an image, or other HTML. (source)

It's also frustrating when a text's trim length is quite short (e.g. 100 characters) and the first sentence is longer than this - this means that nothing gets output. (source)

Proposed solution

Field HTML Trim contains a function that truncates text - taking into account word boundaries, HTML trimming, ellipsis, etc. If we add this function to core, it'll mean we can trim text and ignore HTML tags (addressing the first problem), and trim to word boundaries instead of sentences or paragraphs (addressing the second problem).

Alternatives that have been considered

The Smart Trim module is another option, but it doesn't use the most robust method of truncating text. See https://github.com/backdrop/backdrop-issues/issues/599#issuecomment-1003... for a full explanation and comparison with Field HTML Trim.

Additional information

https://github.com/backdrop/backdrop-issues/issues/309 was opened to address the first problem originally. When the second problem was also pointed out in that issue, https://github.com/backdrop/backdrop-issues/issues/599 was then opened to address that separately.

As discussed in https://github.com/backdrop/backdrop-issues/issues/599#issuecomment-1019..., both of these issues can be fixed with the one function from Field HTML Trim. So trying to fix both separately isn't going to be ideal. This issue therefore deprecates and replaces both of those issues.

Draft of feature description for Press Release (1 paragraph at most)

Backdrop now includes the ability to truncate text while ignoring HTML tags and trimming to word boundaries.

GitHub Issue #: 
6001