{"id":172,"date":"2004-05-04T07:30:00","date_gmt":"2004-05-04T07:30:00","guid":{"rendered":"http:\/\/jclark.org\/weblog\/WebDev\/ThisSite\/mdcomments.html"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-30T04:00:00","slug":"mdcomments","status":"publish","type":"post","link":"https:\/\/jclark.org\/weblog\/2004\/05\/04\/mdcomments\/","title":{"rendered":"Fixing the Comment System, Part 1"},"content":{"rendered":"<p>I&#8217;ve never made a secret of the fact that I don&#8217;t like my comment system.  I even had a warning on the comment form about how bad my comment system was.  No line breaks.  No linking.  No HTML of any sort&#8230; well, except that `<\/p>\n<p>` and `<br>` seemed to work, but no one used them.  It&#8217;s basically the raw [writeback plugin][1] for [Blosxom][2].  The only enhancements I made were to capture timestamps and IP addresses, and to send myself email notification of new comments.  Hardly noticable when trying to read the comments.\n\nI&#8217;ve been meaning to do something about it forever.  Tonight I finally got started.  My main requirements for the new system were:\n\n* Easy to use\n* Typical feature set:  links, bold &amp; italic, code would be nice\n* Maintain valid XHTML, but don&#8217;t require the users to understand XHTML.\n\nIt was the last feature that really dictated terms to the rest of the crowd.  Fortunately, there&#8217;s already a fantastic tool for generating valid XHTML easily, with many common features &#8211; [Markdown][3].  I&#8217;ve been using it for a couple of months to author all of my posts, and I love it.  Using it for comments seemed like a logical next step.  \n\nMarkdown only generates valid XHTML, but it passes through any XHTML in the original text unchanged.  This would allow any comment to invalidate my XHTML.  (It should be noted in the interest of fairness that comment form itsself is not valid XHTML at the moment.  It&#8217;s on my list.)  My solution was to change Markdown to encode all  XHTML (and other uses of &#8220;) entered by the user.  In addition, I had to hack a few templates as well as the writeback plugin.  So far it&#8217;s working pretty well.  All comments are now rendered via Markdown.  If you see any that look strange, shoot me an email.\n\nOne of the best features of Markdown in my mind is that its useful even if you don&#8217;t know it, since it borrows from email idioms.  Blank lines start new paragraphs.  *\\*Emphasis\\** and **\\*\\*strong emphasis\\*\\*** are easy to do.  URLS wrapped in &#8220; become hyperlinks.  Code can be wrapped in `\\`backticks\\&#8220; to format it and escape any nasties.  Blockquotes work like email, just prepend `&gt;` to each line.\n\nOf course, there&#8217;s lots of other features that it helps to know something about ahead of time, such as  code blocks and referntial URLs.  Plus, occasional surprises can occur; writing about the `interpolate_fancy` plugin requires a backslash before the underscore if you don&#8217;t use backticks, or you invoke `<em>` mode.  For this reason, I&#8217;m going to add a mandatory preview prior to posting.  I&#8217;ll also add some Markdown tips to the comment form.  Preview isn&#8217;t ready yet, but Markdown-enabled comments are.  \n\n[1]: http:\/\/www.blosxom.com\/plugins\/input\/writeback.htm\n[2]: http:\/\/blosxom.com\n[3]: http:\/\/daringfireball.net\/projects\/markdown   <\/em><\/p>","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve never made a secret of the fact that I don&#8217;t like my comment system. I even had a warning on the comment form about how bad my comment system was. No line breaks. No linking. No HTML of any sort&#8230; well, except that <code> <\/code> and &#8220; seemed to work, but no one used [&hellip;]<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-172","post","type-post","status-publish","format-standard","hentry","category-thissite"],"_links":{"self":[{"href":"https:\/\/jclark.org\/weblog\/wp-json\/wp\/v2\/posts\/172","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jclark.org\/weblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jclark.org\/weblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jclark.org\/weblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jclark.org\/weblog\/wp-json\/wp\/v2\/comments?post=172"}],"version-history":[{"count":0,"href":"https:\/\/jclark.org\/weblog\/wp-json\/wp\/v2\/posts\/172\/revisions"}],"wp:attachment":[{"href":"https:\/\/jclark.org\/weblog\/wp-json\/wp\/v2\/media?parent=172"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jclark.org\/weblog\/wp-json\/wp\/v2\/categories?post=172"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jclark.org\/weblog\/wp-json\/wp\/v2\/tags?post=172"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}