MMD to many html-files

I’m just checking that I understand things correctly:

Am I correct when I say that it’s currently not possible to export a MMD document to multiple HTML files?

(in my case, write a web site with multiple pages in scrivener and export it directly to HTML files)

Possible workaround is to export them as text files and then use a script to do the MMD processing

That is correct. In general the compiler is not designed to be a multi-file generator or scripting engine. It’s meant to take a thousand pieces and join them all together into one file. That may change eventually. There is already a prototype for this behaviour with the iBooks Author output model. It uses Separators to establish file cuts. That seems to have worked well, so it may be we apply it as an option to other formats too.

Well perhaps speaking more conversationally here, but that strikes me as going about it inside-out. The premise of the MultiMarkdown format is that it is a human readable document, that is at the same time a machine precise script file embedded in to the content—but like HTML is, but at a lower impact. It is designed to be processed into other forms. There is in fact a script for converting MultiMarkdown to ePub, which is itself a multi-file format. That shows the premise of how MMD is meant to be used—although it does require some programming skill, or at least enough to pick apart an example and change it to do something else.

Yes, I agree about MMD.

Most of my writing is either short 1-2 page documents or web sites (small ones). I’ve done these web sites using HTML, MMD, various Wikis, etc but MMD has always been the quickest and fastest way for me to produce the content. An extra plus is that it becomes easy to reuse the material in another place.

However, the problem has been to find a good, easy, quick to set up workflow to

  • organize the content of the pages and the pages themselves
  • do the actual conversion from MMD to HTML, including handling of image files, support files, templates, etc.

My latest attempt has been to use VoodooPad, which it works well for the second bullet above lacks a bit in supporting the actual writing process. Scrivener is excellent for the first bullet but doesn’t really seem to work for me when it comes to the second bullet.

So, I’ve started to write my own “static site generator” to get the features I want.

If you are adventurous and have a budget for software, you might want to check out Tinderbox. I used this program to generate web sites for a number of years (I probably would have used it for Lit & Lat’s site, but we wanted to keep the site accessible to multiple people). It can read Scrivener projects wholesale, meaning you could develop a site generator kit off of the expected components of Tinderbox’s take on a Scrivener project, and go from there.

I’m not sure what that will give you over a couple of scripting languages and some text files though. I mean, Tb offers a lot more, but specifically to convert MMD to a web site rather than a web page, scripts might be better.

And this sums up why we love you. Always willing to confuse the heck out of the headless and hyphenated-k while ensuring support for others.

I need this functionality for a project I’m working on. And I’m actually looking to create another format for output for Scrivener, which is similar to Markdown… AsciiDoc. Can you give me some pointers to the docs on creating our own Formats? My search-fu is failing today.

I am not aware of any body of documentation regarding MMD’s script-able side. Basically there are a some XSLT files that can be installed with an optional support package, into your ~/Library/Application Support/MultiMarkdown folder. These XSLT files demonstrate various outputs, as well as underlying generators that the outputs use. These are what I used to train myself both in XSL and in what MMD produces. Once you have an XSLT that produces the format you require, you would use the XSLT option in the compatibility compile pane to enable this alternate workflow, and add a meta-data token so that the XSLT is triggered when you compile. I tend to use LaTeX for this, even if that isn’t the format I’m actually generating.

For example, I can choose “MultiMarkdown->LaTeX” as my compile format, check off “Use XSLT post-processing” in the Compatibility compile option pane, then in the Meta-Data pane, add a key for “LaTeX XSLT”, specifying the filename as the variable. Now, assuming there are no syntax errors in the XSL, and that it is in the correct location in your library folder, you should be able to compile directly to your custom format.