How can I retrieve MultiMarkdown document metadata (as defined here) using php? I was rather surprised that I couldn't find a MultiMarkdown php parser, PHP Markdown Extra doesn't do MultiMarkdown.
I'm afraid that the scripts that MultiMarkdown's comes packaged with have all the answers for somebody that would know how to define/use a custom XSLT, but sadly that's not my case.
MultiMarkdown Document Metadata goes like this:
Title: A New MultiMarkdown Document
Author: Fletcher T. Penney
John Doe
Date: July 25, 2005
I would like to use my own properties and control where they will be displayed in the output. By default, mmd2XHTML outputs the above (pre-defined) variables in tags, but I need to display them somewhere in the HTML body.
thanks
I am not an expert in php, but the easiest way would probably be to call out to the multimarkdown binary as a shell command, e.g.
This command would output the value of the title metadata for foo.txt.
This is basically the approach I use in perl, Objective-C, and shell scripts, and is the reason I added the
-e
flag to MultiMarkdown to begin with.The XSLT approach is great if you are using MMD to actually generate the HTML result, but probably not as useful in this circumstance.
Your other option would be to write a custom regular expression to grab what you need, but why reinvent the wheel?