I’ve altered the code a bit to have it check whether the wpautop filter is being used. Sometimes I want to disable this for particular themes and this makes your plugin a little less agressive when it comes to using that filter.
So if a user in their functions.php file removes the filter,
remove_filter ('the_content', 'wpautop');
then this code will honor that:
public function maybe_default_formatting($content) {
if ( ! $this->is_markdown( get_the_ID() ) ) {
if( has_filter( 'wpautop' ) ) {
$content = wpautop($content);
}
}
return $content;
}