I have an ACF-field, that gives an output like this:
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<p><img class="alignnone size-large wp-image-48" src="http://example.org/wp-content/uploads/2019/01/foo-bar.jpg" alt="" width="1024" height="640" /></p>
<p>Sed lacinia enim a <strong>est aliquet</strong>, et accumsan ex pellentesque. </p>
<p>Adipiscing elit, lorem ipsum dolor sit amet, consectetur.</p>
... Both images and text.
With wp_html_excerpt I can remove all tags, so I get one long text-blurp.
But with WordPress' native excerpts, then it doesn't remove line-breaks or bold text, which I find nice.
How would I go about achieving, getting an excerpt like that, from my ACF-wysiwyg-field?
So ideally, I would call my function like this: create_neat_excerpt( $html, 15 );
and get an output like this (from above-given input):
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<p>Sed lacinia enim a <strong>est aliquet</strong>, et accumsan...</p>
Addition: My current attempt
$project_desc = get_field( 'project_description' );
if( !empty( $project_desc ) ):
$trimmed_text = wp_html_excerpt( $project_desc, 800 );
$last_space = strrpos( $trimmed_text, ' ' );
$modified_trimmed_text = substr( $trimmed_text, 0, $last_space );
echo $modified_trimmed_text . '...';
endif;
<strong>
-tags.the_excerpt()
you provided, it actually says "An auto-generated excerpt will also have all shortcodes and tags removed."