[wp-hackers] wpautop should first check if p tags, and if so, don't autop

Lloyd Budd lloydomattic at gmail.com
Sat Aug 25 00:15:02 GMT 2007


wpautop should first check if <p> tag in a $pee, and if so, assume
person knows what he is doing and don't autop

Everyone's favorite wpautop !

wpautop( $pee, $br = 1 ) - Returns the text with HTML formatting for
paragraphs, WordPress
automatically paragraph.

Before putting this in trac, I wanted to raise this here, because I
lack the historical context, though I have tried to research it.

For those newer to WordPress, WordPress generally stores your content
as you typed it (or import it), and then "filters" it when someone
loads the content (output) in their browser. This behavior allows for
the huge range of input plugins, the most famous probably being
http://daringfireball.net/projects/markdown/
http://www.michelf.com/projects/php-markdown/

It is a famous wp-includes/default-filters.php and the code is in
wp-includes/formatting.php

It's safe to say that wpautop drives some people crazy, and that is
why http://urbangiraffe.com/plugins/disable-wpautop/ is a favorite,
and why articles like
http://wpbits.wordpress.com/2007/08/06/a-look-at-wordpress-filters-disable-wpautop-on-post-formatting/
are such an entising read.

On the other hand, most of us love it (most of the time), or don't
even notice its wonderful magic -- it's that good ;-)

Working through some scenarios, specifically importing from other
blogging platforms, or pasting in HTML, the current (default) behavior
is... awkward.

Entered:
<p>I may be
too smart for my own good</p>

Output:
<p>I may be <br />
too smart for my own good</p>

As the Subject reads, I think the best experience given the
implementation is for wpautop to first check to see if there is any
<p> tags in the input and if so don't automatically paragraph, line
break, etc.

If the entered text is a mix of HTML and plain text, too bad for them,
they don't get an wpautop.

Thank you,
-- 
Lloyd Budd | Digital Entomologist | | Skype:foolswisdom
WordPress.com | WordPress.org | Automattic.com


More information about the wp-hackers mailing list