bug in Multimarkdown Settings

After spending a few hours on and off scratching my head each time I exported my document, and then spending at least 2 1/2 solid hours nitpicking every xslt file in the MMD exporter trying to find the cause of my frustrations: I have found that there is a bug in the Multimarkdown Settings pane.

In the MMD settings of Scrivener, if, in one of the metadata panes, you enter your desired text and then also include a , your MMD output – whatever type of MMD export you use – will include a bunch of Scrivener metadata, right the beginning of your text, that you didn’t ask for, and that you don’t want.

Upon erasing that singe hard-return after the last word in the pane, everything is normal again. But it took me quite a while to pinpoint this as the problem. Thinking this to be an MMD bug, I emailed poor Fletcher at least half a dozen emails as we tried to resolve this (patient guy, he is).

So this is #1: a warning to not hit the return key in the pane of the MMD preferences, and #2: a bug report.

This happened to me once, as well. The main difficulty is that it is (nearly) impossible to tell that there is a trailing (return) at the end of the metadata. And since Scrivener is going to add it’s own metadata to the mix you end up with:

Title: Something
Author: Somebody

XHTML Header:
body \{font....

The XHTML Header part is added by Scrivener for formatting reasons at Keith’s request. The Title and Author is entered manually by the author. The problem is that blank line in between, which signals the end of metadata.

Possible solutions:

  1. Do nothing, and publicize this as a known common pitfall (I suppose it’s not technically a bug, but it’s like a wide open manhole cover - sooner or later someone’s going to step through it, and it’s hard to figure out what’s going on when it happens the first time.)

  2. Before pasting the user entered metadata, strip off all newlines at the end, and then add one back so that the XHTML Header part is on it’s own line, but without a gap regardless of whether there is an accidental newline.

  3. Put the XHTML Header and Format: complete at the top of the document, before the user entered metadata. This way, Keith is responsible one time for making sure the newlines are correct, and then it’s fine after that. If there’s an extra newline in the user entered metadata, it doesn’t matter.

4)I suppose this also begs the question as to whether the XHTML header information should be included or not… In some ways it’s contrary to what MMD users expect - you enter a plain text document, and it comes out formatted for some reason in a formatting you didn’t specify. The utility scripts that are included in MMD already add the “Format: complete” bit, so the entire section of metadata that Scrivener adds could actually be eliminated. This would also solve the original problem.

  1. Like #4, but make this additional metadata optional

Just my thoughts - I don’t necessarily have a preference (though I suppose that #4 is actually the “purest” solution.) Whatever Keith decides (with input from this discussion) should be good. (I can always write a script to go back and strip out the metadata that Scrivener adds, so it’s not a huge deal to me.)


I think for now I will stick in a short notice in the troubleshooting section of the FAQ, describing the symptoms and what to check for. This one has got me in the past to, and I even know about the problem.