TODO: Use first paragraph as default teaser

I'd like the default teaser to be the first paragraph of text when not specified.

Trimmed options and Smart Trim module can limit by character count and strip HTML, but doesn't have this option.

I added a comment to suggest using xpath to keep/trim content.

https://www.drupal.org/project/smart_trim/issues/3223838#comment-15435717

There is an old D7 module that did it, some of the code looks useful for parsing the text.

https://github.com/fullfatthings/first_paragraph/blob/7.x-1.x/first_paragraph.module

Instructions for computed fields in Drupal are a bit complicated, plus integrating with views is needed.

https://www.drupal.org/docs/drupal-apis/entity-api/dynamicvirtual-field-values-using-computed-field-property-classes

 

Tags
Modules