HTML in excerpt WordPress 6.2.2

To get started, you’ll need to remove the wp_trim_excerpt function from the get_the_excerpt filter:

remove_filter( 'get_the_excerpt', 'wp_trim_excerpt', 10 );

This will result in no auto-generation of excerpts (manually entered excerpts will still show).

From here, add your own function and filter for generating the excerpt:

function trim_excerpt_with_html( $text="", $post = null ) {
    ...
}
add_filter( 'get_the_excerpt', 'trim_excerpt_with_html', 10, 2 );