markdown via email test
This is a test of that same script send via RTF email:
And it’s gone a bit wrong again. Well, this isn’t Posterous' fault, but Outlook’s. When I highlight a block of code and tab it in wholesale, instead of inserting tabs, Outlook decides to fuck around with the HTML. What a surprise! I’d never have expected that.
[p class=MsoNormal style=‘margin-left:72.0pt’]function strip_html_tags( $text )[o:p][/o:p][/p]
n.b. < > replaced with [ ]
OK, I can see the point in using styles, to a point. But a new set of p tags with the same style tag AND a class on EVERY LINE? Oh, COME ON Microsoft! And what on EARTH is [o:p][/o:p] for? BAD Outlook. No biskwits for you.
Can Posterous work around this? It’s easy to replace every instance of style=‘margin-left:72.0pt’ with two tabs, but does every user have Outlook set up to use that size and units? If not, it gets damn complicated. Good luck to them, I wouldn’t want to do it. Dealing with MS' idea of HTML is a daily nightmare for me and probably anyone who ever reads this (probably no-one!)
Posterous Chris is still working on the problem with MCE chewing up the Object tags in the script, but that’s a separate issue.
/**
Remove HTML tags, including invisible text such as style and
script code, and embedded objects. Add line breaks around
block-level tags to prevent word joining after tag removal.
*/
function strip_html_tags( $text )
{
$text = preg_replace(
array(
// Remove invisible content
'@@siu',
'@@siu',
'@@siu',
'@]*?.*?@siu',
'@]*?.*?@siu',
'@]*?.*?@siu',
'@]*?.*?@siu',
'@@siu',
'@]*?.*?@siu',
// Add line breaks before and after blocks
'@