WordPress.org

Ready to get started?Download WordPress

Forums

Markdown on Save Improved
Linebreaks aren't always ignored. (4 posts)

  1. markstos
    Member
    Posted 2 years ago #

    I'm using "Markdown on Save Improved" 1.1.5 with WordPress 3.2.1.

    Many times I have problems with linebreak handling. According to Markdown rules, a
    should only be inserted if there are two more line breaks, or multiple spaces at the end of a line. However, I keep finding that
    tags have been interested throughout my documents.

    http://wordpress.org/extend/plugins/markdown-on-save-improved/

  2. Matt Wiebe
    Member
    Plugin Author

    Posted 2 years ago #

    Mark's initial plugin took a hybrid approach where it's run through Markdown, but then paragraph tags are stripped and the remaining text is run through the wpautop filter, which inserts paragraphs for double linebreaks and br tags for single linkebreaks.

    Is that what you're describing?

  3. Matt Wiebe
    Member
    Plugin Author

    Posted 2 years ago #

    This should be fixed now. Now overriding WP's usage of wpautop.

  4. westhomas
    Member
    Posted 2 years ago #

    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;
    }

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic