WordPress and formatting

Some users may have noticed that posted entries (either via ecto or via the online control panel) could show up with extra linebreaks on their WordPress blog. This is caused by WordPress applying all active formatting plugins to the posted entry when it's loaded into the index page. In particular, when the entry already has HTML tags, WordPress will still apply Textile formatting, which in turn converts linebreaks to additonal break tags. Deactivating the textile plug-in is not a really good workaround, but you can edit the textile plug-in so that it won't harm entries that are not in textile:

Open textile1.php and replace the line:

  function textile($text) {

with:

  function textile($text) {

  if( preg_match("/<p>/",$text) || preg_match("/<br/",$text) )
  {
      return $text;
  }

All this does is return the text unharmed if it contains paragraph or linebreak tags, which is pretty decent indicator that the text isn't textile formatted.

Posted by Adriaan on October 13, 2004