needs must make MD ignore my PHP

Paul Ingraham, RMT paul at
Mon Jan 29 00:31:55 EST 2007

On 28-Jan-07, at 5:50 PM, Michel Fortin wrote:

> Le 2007-01-27 à 20:54, Paul Ingraham, RMT a écrit :


>> I need to exclude arbitrary chunks of my documents from Markdown

>> parsing, because my documents are littered with <?php blah blah ?>,

>> and a few other oddities. These blocks get gifted with unwanted

>> markup by Markdown:


>> <?php blah blah ?> becomes <p><?php blah blah ?></p>


>> If I can't make it stop that, it's a dealbreaker for me in an

>> otherwise fascinating and incredibly useful tool. And my gut tells

>> me that there has *got* to be a way, even though I've scoured the

>> syntax docs and can't find it. (I did notice a mechanism for doing

>> this via WordPress (<MTMarkdownOptions output='raw'>), but that's

>> WordPress. I'm handcrafting documents in BBEdit.)


> Hum, I'm not sure where you're adding these PHP blocks that get

> caught by Markdown. Are you converting Markdown to HTML using BBEdit,

That. I'm not quite sure how to clarify what I've already written.
Perhaps I can give a little more context. Markdown converts this...

Lorem ipsum dolor sit amet, consectetaur adipisicing elit...

<?php $blurbno = rand(1,28); require("begblurbs/begblurb
$blurbno.html"); ?>

Lorem ipsum dolor sit amet, consectetaur adipisicing elit...

To this...

<p>Lorem ipsum dolor sit amet, consectetaur adipisicing elit...</p>

<p><?php $blurbno = rand(1,28); require("begblurbs/begblurb
$blurbno.html"); ?></p>

<p>Lorem ipsum dolor sit amet, consectetaur adipisicing elit...</p>

The <p> element around the php line is problematic. I need Markdown
to ignore the php!

>> What can I do to convince Markdown to ignore my php?


> It's hard to give advice without knowing more, but it's certain that

> < MTMarkdownOptions> won't work in WordPress because it's a template

> tag for MovableType, not WordPress.

Sorry, I remembered the wrong technology. Anyway, I'm not using
either. I'm publishing the old-fashioned way, marking up my own html
in BBEdit, but also using php extensively. Markdown treats my php
statements just like paragraphs, and marks them up.

Thanks for tackling this, and I hope I was able to clarify the
problem. Any ideas?


More information about the Markdown-Discuss mailing list