Compiling for MMD>fodt

I must be missing something. I’m trying to compile to MMD for .fodt so that the headers will be recognized. I have tagged them with # before and after, in numbers reflecting the header level. But the compiled document simply includes the hash signs and doesn’t interpret them as marking headers. Do I have to do something other than select “Compile For: MultiMarkdown > Flat XML (.fodt)”?


I’m not clear from what you say, whether you’ve tagged the Scrivener document title, or in levels in the Formatting pane of the Compile dialogue. If you’ve done the second, then it should just work.

(And if you’ve done the first thing, then you need to do the second.)

((And if you know all of that, hopefully someone who knows more than I do will be along in a minute.))

Thanks. I had added the hash tags to the document titles, not the formatting levels, so I added them there. Rather, I added two more formatting levels and Scrivener seems to have added the hash tags for me. I see no way to add hash tags to the formatting levels myself. But after adding more levels, I see that they automatically have additional hash tags. It didn’t seem to change the output, though.

The only headings that have any heading style applied to them when I open the FODT file in LibreOffice are those to which I added 8 hash marks to the document title. None of the other headings have any style applied, nor do they have any formatting that looks like a header. I’m encouraged that at least one style is present (“Heading 6”), but I’m confused about how this works.

If you’re on a Mac, there is generally no reason to add your own hashmarks (whether in the document or in the compile settings). Scrivener adds these for you automatically based upon the depth of an item in the outline, so long as it prints its title. The necessity of having to manually manage all of these hashmarks in the right quantity is one of the advantages of using this software to generate MMD documents.

But if you need exceptions (I need them sometimes as well—a thing just needs to not be a chapter even if it is on the same level as chapters in the outline, for example), then the “Compile As-Is” setting will disable automatic title generation for that section. Then you could type it into the content. Something like this would help keep the document agile, and sufficiently abstract the code from the content, so that you could write a Replacement macro for it if it is done often enough:

## <$title> ##

There are ways to tweak the compiler to omit the hashmarks, but I find them to be more trouble than they are worth, unless you have hundreds of them and something like the above trick becomes unwieldy. In that case try using the “Insert title as run-in head” in the “Title Appearance” tab of the Section Layout feature. You would then probably want to do something in the Prefix and Suffix fields.

For example if you have a bunch of glossary entries and you want to use the MMD dictionary syntax for a result like this:

Document Title
: Content of the document goes here.

Second Document
: More content...

Then an empty prefix would be used, with a suffix of:


: [/code]

The whitespace is important there. It is a carriage return (to separate the title from the next line), then a space following the colon to set the first paragraph of the document on that line after the colon.

That is also where you could insert your custom quantity of hashmarks. So long as the outline can be procedurally addressed by type and level like this, that would work. The As-Is method will work for one-off exceptions better.

Thanks for the detailed explanation, Amber. I actually understood 10% of it!

Since what you described did not match what I was seeing, I decided to verify that I was doing something that messed it up. So I created a new blank project, and created the documents within it, and set the Compile > Formatting to print the title for all, and compiled. That produced a document that had styles applied to all the paragraphs in it (just titles), which is proof this will work if I do it correctly.

After reading your post, I used Project Replace to remove all hash signs to see if that helped. When I compiled that document, which started out as a Word import, no headings were created. So some setting or other in my initial test document screws the whole thing up. Before I removed the hash marks I had added to the titles, a few headers were created, but not in a pattern I could understand.

So I’ll start with my new, mostly empty, project, adding one thing at a time and compiling to check the results. Maybe I’ll discover what messed up the first test. Maybe not. Along the way, I’ll try to understand the rest of your post, like the boxed beginning with “CODE:”. There seem to be some very useful tips there, so I’ll work to understand them.

Thanks again for the assistance.

Okay, I’m still unclear on where your headers actually are/were, but what you are optimally shooting for, with a basic outline that follows the book structure (part/chapter/section/etc), are binder names that are precisely what you want the reader to see when they crack open the book, nothing more nothing less. No code in them, just a folder called “The Grassy Knoll”, and then the Title box checked in the compile Formatting settings for each type of document that should print its title visibly. That’s all you have to do. Just visualise everything that is directly under the Draft folder as Heading 1, and all of their direct children will print as Heading 2 style, and so on, up to six levels of heading depth.

Everything else is for when you run into situations where a clean and procedural approach like that does not work.