Pushing PHP code through to HTML

Hi. I’m using Scrivener 2.3.1 on a Mac to write articles for my blog. I’ve set the preferences in Scrivener to turn off smart quotes and converting double-dashes. I compile to HTML using MultiMarkdown. I haven’t changed any settings in MultiMarkdown.

For most of my articles, this works very well. The problem is that for the “archives” article, I need to include a snippet of PHP code to return the list of articles. The code is simply:

<?php echo $model->listOfArticles; ?>

In the output, that is getting converted to

<p><?php echo $model->listOfArticles; ?></p>

That just displays the statement.

I noticed that if I wrap the code in HTML comments:

<!-- <?php echo $model->listOfArticles; ?> -->

the output is close to expected:

<!-- <?php echo $model->listOfArticles; ?> -->

So, it may be that MultiMarkdown doesn’t recognize the php tag.

Has anyone run into a similar problem? If it’s not something with Scrivener then I’ll bounce over the MultiMarkdown community and ask.


I should add that I’ve got a workaround. I run a post processor that changes the to ?>. Although it works, I would like to simplify if it’s possible.

I don’t think MMD has anyway of recognising php tags, so your route of commenting them out and post-processing the <!-- to <?php is probably the only solution.