Validating comments (and fixing comment preview)
Long-time readers, particularly those of you who post comments now and then, are probably aware of some ongoing problems I’ve been having with my commenting system. Commenters have had to use Markdown instead of HTML, code snippets were removed, escaped entities were unescaped by the comment preview and then removed when the comment was posted.
Every now and then I’ve had a go at fixing the problems, but each time I got stuck. The situation was complicated by the fact that this site is using an old version of Movable Type for the back-end. Movable Type is written in Perl, which I am not too comfortable with. That obviously made it even more difficult for me to track down the problems I was having. It was very frustrating.
Yes, I considered upgrading Movable Type. But I rely on many different plugins and have patched the MT code quite a bit, so I am very nervous about upgrading. I expect something will break, and I don’t need the stress that would cause me. I looked at other platforms, but none of them looks good enough to motivate a switch. So I’m sticking with Movable Type since it works well enough for me. Except for the problems with comments.
However, most (all?) of those issues should now be fixed, in no small part thanks to the help I got from Jacques Distler when i had problems getting his MTValidate plugin up and running. Thanks, Jaqcues. I won’t forget those beers I promised you :-).
So what do the changes mean for anyone posting comments here? A number of things:
- Only HTML 4.01 Strict is accepted. If your comment contains invalid HTML, a list of validation errors will be displayed, and you will be asked to correct the errors. Your comment cannot be posted until you have done that. No more
blockquoteelements with inline content, which I complained about in Use only block-level elements in blockquotes ;-).
- Markdown is still the preferred method for marking up comments, but the HTML elements and attributes created by Markdown can be entered manually if you prefer doing that.
- Markdown should work properly now, so you can post code examples and use backticks (`) to create
- Escaped entities are no longer unescaped by the comment preview, so you don’t have to retype all those
>entities that took you so long to enter. This has been a bug in my comment preview for a couple of years or so. It turned out to be an embarrassingly simple fix, again thanks to Jacques.
- There should be less spam. Not that I think most readers will have noticed much of it since I am pretty quick at removing spam (and I am considering more and more comments that look legitimate at first glance to be spam), but I do get hit by spam floods every now and then. Spam robots should find it harder to post comments now that i am Forcing Comment Previews.
In case you’ve accidentally entered invalid markup in a comment recently, now you know what’s up with the error message you got.
Update: Well, a bulletproof way of making any bugs come out in the open is to post an article claiming that those bugs are gone.
Shortly after posting this I found a problem related to the forced comment preview in combination with Markdown. When Markdown outputs HTML it somehow, and only sometimes, makes the commenting script think the comment has been edited between previewing and posting.
I’ll try to find out what’s causing it but it will have to wait. Apologies for any confusion.
Subscribe / follow
DreamHost web hosting
Use the promo code 456BEREASTREET3 to save USD 20 when you sign up for DreamHost