Importing Markdown posts to WordPress
drdrang at gmail.com
Fri Dec 28 01:23:12 EST 2007
On Dec 27, 2007 8:29 PM, Sam Angove <peasant at gmail.com> wrote:
> It's almost certainly [this], in WordPress's MT importer:
> $line = trim($line);
> If it's needed at all (for removing trailing newlines?), `rtrim` ought
> to do the job without destroying your codeblocks.
Thank you, Sam! Changing
$line = trim($line)
$line = rtrim($line, "\n")
did the trick. The import will not work at all if the line is
commented out, so apparently getting rid of the newline is necessary.
Since a pair of trailing spaces means <br/> in Markdown, trimming
*all* whitespace from the end of the line is also wrong. (I didn't
notice the missing <br/>s when I posted earlier.)
Tomorrow, when I'm more awake and more likely to write a coherent
message, I'll send off a note regarding this to the WP people, giving
you credit for the fix.
More information about the Markdown-Discuss