Feature request: trust

I just suggested a feature for WordPress… Trust.

  • If I put a div into my content, it’s because I wanted a div, not a p. It is none of WP’s business why.
  • If I nest elements like divs, it’s because I wanted them nested.
  • If I put an <a name=”…” / > into my content, it’s because I want an anchor. It’s not a malformed link.
  • If I am smart enough to edit in HTML mode, I would like to be treated as smart enough to solve my own HTML problems.
  • In short, I never want to “UPDATE posts” again; it obviates the entire purpose of having a CMS. I want a mode in the editor where it just smilingly takes the HTML I feed it, pushes it into the DB, and lets me shoot myself in the foot if what I need is a hole in my shoe.

The Disable wpautop plugin is kind of a start, and I will probably implement a counterfeature in my own installation to undo WP’s alleged HTML correction feature (both “correction” and “feature” are being modified by “alleged” there), but I sense that I’m not the only one who wants WordPress to just trust me. I sense this because no one who has anything to say about wpautop, the function in wp that “corrects” your HTML, has anything nice to say about it.

Also, the 2.1 post editor is a huge step backwards. I am seriously considering downgrading. I miss 2.0.x’s html editing mode; 2.1’s Code editing mode is nearly useless. It is really hard to make 2.1’s editor as nice as 2.0.x’s.

Update: The plugin mentioned above wasn’t working for some reason, probably because it was written for 2.0.x. I’ve gotten the 2.1 editor doing almost exactly the right thing by lobotomizing the functions wpautop() and cleanpre() in wp-include/formatting.php — that is, reducing the function bodies to return $pee; and return $text; respectively— and then turning off the per-user “Use the visual editor when writing” setting on my user profile. balanceTags() seems like it might be genuinely useful, and could benefit from a more selective brain surgery down the road. I will probably try to come up with something better than complete decerebration later, but for now frustration > will to code.

Anyone who wants a copy of the “fixed” (in the same sense that a dog is “fixed” I guess) formatting.php can get it here. I’m offering it as is, with no support and no warranty of fitness for any particular purpose, etc etc. Sorry if it makes your web site a-splode. Remember to back up your current copy of formatting.php before putting my dumber version in its place.

2 Comments

  1. Leo:

    Hi, just wanted to let you know that the issue here has bugged the crap out of me for a long time, so I decided to write a plug-in to fix it.

    Here’s a link to what I came up with:

    Trustworthy XHTML

    It’s a combination of a hacked version of wpautop() and some controls on TinyMCE that allow for less auto-formatting, including one level that disables them entirely.

    Hope this helps! Have a great day!

  2. MikeSchinkel.com » Blog Archive » Fixing WordPress’ Eating of HTML div Tags:

    […] little googling and I uncovered lots of discontent on the topic along with a few hacks and a hackish plugin, none of […]

Leave a comment