For the last few weeks, I have been wrestling with Markdown, Textile and Textpattern in an attempt to fix our comments. We use Markdown for text formatting on Particletree (and we love it), but it’s been making our comments useless. Basically, it was just stripping out the HTML and leaving people with no way to add links to their comments (Textile didn’t work OR Markdown).
Well, I finally figured out how to make everything work in peace and thankfully, you only have to change one line of code. The following refers to Textpattern 4.01.
For those that know, installing PHP Markdown is easy. All you have to do is renamed the markdown file to classTextile.php
and replace the Textile formatting file of the same name in the ‘textpattern/lib/’. Before you do that though, rename your old classTextile.php
so you don’t lose it. For example I rechristened ours classTextile-old.php
.
Then find the txplib_misc.php
file in your textpattern/lib/
directory. Locate the markup_comment
function (around line 1134) and rename the following line:
include_once $txpcfg['txpath'].'/lib/classTextile.php';
so it refers to your original Textile file. Like this:
include_once $txpcfg['txpath'].'/lib/classTextile-old.php';
And boom. You can use Markdown for your articles and have textile formatting in your comments.
When I first switched to Markdown from Textile, I ran into that problem as well. Then I found Johan Nilsson’s post on TXP and Markdown, applied his changes, and everything Just Worked. Granted, that was back in the days of RC1, but it might be somethign to look into.
With Textpattern 4.01 you still can use Markdown for comments. Based on the code by Johan Nilsson(linked by James above), you have to make some changes in the same txplib_misc file, same function (markup_comment): two lines need to be commented out, one need to be modified, lines 1144-1147):
@//$msg = trim(nl2br($textile->TextileThis(strip_tags(deEntBrackets( //$msg //)),1,’’,$im,’’,(@$comment_nofollow ? ‘nofollow’ : ‘’)))); $msg = trim($textile->TextileThis(strip_tags($msg)));@
That way I get the full range of Markdown formatting, and I can have real block level tags in my comments (I hope this comes out correctly, Textile in Textpattern comments isn’t very good, esp for code).
Are the Markdown vs. Textile wars to blame for the screwed-up formatting of your feed?
Everything is in one big paragraph, and links are not links but are in long-form with square-brackets/normal brackets.
I just upgraded from 1.0RC1 to 4.0.1, applied the changes to txplib_misc.php, and everything Just Works with PHP Markdown Extra.