Just i'm trying to implement Markdown in my site for sending mails to users, and seems not working well.
Some works ok, the strong emphassis works, but line breaks, headers etc do not..
I tried with both PHP Markdown and extra
PHP Version 5.2.17
my simple code: coming from a textarea:
$mail_contingut = Markdown($_POST['missatge']);
I tried the sample markdown syntax from http://daringfireball.net/projects/markdown/basics and emailed $mail_contingut to my e-mail.
A First Level Header\r\n====================\r\n\r\nA Second Level Header\r\n---------------------\r\n\r\nNow is the time for all good men to come to\r\nthe aid of their country. This is just a\r\nregular paragraph.\r\n\r\nThe quick brown fox jumped over the lazy\r\ndog's back.\r\n\r\n### Header 3\r\n\r\n> This is a blockquote.\r\n> \r\n> This is the second paragraph in the blockquote.\r\n>\r\n> ## This is an H2 in a blockquote
Note that I bolded the fox, as it works perfect the double astherisk like some links, but headers, bloqueotes or line breaks, as you seen, nope.
I'm missing or doing something wrong?
I doubt very much this is an issue with PHP Markdown or PHP. I'd suggest you check what is the exact content of $_POST['missatge']. If it is littered with \r\n everywhere (as opposed to real line breaks) like I can see here, Markdown won't treat these a line breaks and most of the syntax won't work.
Thanks for the help, i'm checking my code and i found this at the start of the script after the mysql connection:
$_POST = array_map("mysql_real_escape_string", $_POST);
I guess this is giving problems!
eureka, this is it....