Export to Multimarkdown and to Word

I’m using the styles in Scrivener 3 to denote heading levels and was wondering if there is a way to export or compile to a Multimarkdown file that preserves the header levels.

Otherwise, is there a way to export or compile a file to a Word document and strip out setting for font face and size that I’ve set up in Scrivener? I want to preserve the styles, but that’s it.



If you use MMD there is no need to explicitly define heading styles in Scrivener: binder levels are converted to Markdown Heading levels (denoted but 1-6 #), which get converted to Word Heading1-6 automatically. Pandoc is much better at generating a well formed word document directly from Scrivener’s MMD compile. MMD is a plain text format, and so style data is always stripped out, leaving the semantic structure alone (block quotes, figures, emphasis etc), allowing you flexibility in the final output.

If you don’t want to use MMD, then you must use the style mapping in compile. Keith did not want to add heading styles as a default on DOCX compile, and so you must create Heading 1-6 styles and map them using a custom compile format manually. Personally I find MMD+Pandoc a much more flexible route. The other major advantage of Pandoc is you can create a “blank” Word document with your preferred styles, page layout etc, and you pass this to pandoc and it will extract the style and page metadata and apply it to your new document. This means no fiddling in Word afterwards…

If you create styles in Scrivener with precisely the same style names as Word’s Heading styles, when you compile to Word, the styling of paragraphs set in those styles will be controlled by Word’s heading styles (b/c the style assignment is carried over into the Word environment).


@gr: the slight caveat being if you generate titles from the Binder names you cannot directly style these in the editor; they must be assigned by using section types in the compiler.

Thank you, nontropo for your advice about PanDoc.
I’m working with assignments for a class, so I don’t want to use binder for heading structure. For instance, I’m writing about 30 discussion board posts, and I’d like each to be self-contained. (Perhaps I’m pushing Scrivener in directions it is not supposed to go.)

I’m not wedded to MMD files. I just need something that will preserve HTML structure so that I can create 508 compliant content for my classes.

Would your solution, or some variation of it, work?


You can use styles for MMD style headings, that’s no problem from Scrivener’s point of view. I agree with Nontroppo, typically speaking it would be better to use sections and types to handle structural decisions like that, but if the documents are quite short and there is no need to break them up, then styles make a good bridge.

The trick is to go into the Styles compile format pane and create a matching heading style (by name), and use those Prefix/Suffix options to bake MMD hashmarks into any instance of text using the style. I’ve attached a very simple demonstration. You’ll see some junk text that when compiled will acquire Markdown-style heading syntax on those styled headings in the editor. To see how it works:

  1. Load up File/Compile…
  2. Double-click on the “MultiMarkdown with Styled Headings” compile format.
  3. Go to the Styles format compile pane.

Now take a look at the Heading 1 – 4 styles, in particular the prefix/suffix settings to the right (you can for the most part ignore the formatting editor with MMD).

If you want to use that format as starting point in your project:

  1. Flip the Save to option at the top of the format designer window to “My Formats”
  2. Click Save. Now it is yours.

I would say you are doing just fine. :slight_smile:
17326867-scriv-mmd_as_headings.zip (21 KB)

Hi AmberV,

Thank you for the style template. It solves almost all of the challenges I was having. The two that remain are lists and hyperlinks. The lists are being tabbed indented, so they are in a block quote format in Multmarkdown. (This is just an aesthetic problem.)

The other problem is the hyperlinks which are losing their linkiness after the conversion. The text is still there, but it is no longer a link.

Is there an easy fix?

And to go back to the Word export, is there a way to keep the styles but strip out any formatting? In other words, I don’t want any special formatting to be passed through to Word. At the moment, my Word documents are picking up the formats from Scrivener.

Paul K.

Well there are two options you could take here, both are in the gear tab of compile overview with a Markdown-based file type selected:

  • Convert rich text to MultiMarkdown: that does almost everything, including links. That may be too much though, seeing as how you’re wanting to strip out most formatting.
  • Convert tables and lists to MultiMarkdown: this is a setting I’ve been using myself for a bit in some things. I don’t use it for everything because those bullets aren’t as nice when you just want to copy and paste rather than fully compile. But, if you are compiling then they can be a nice alternative to typing in the numbers and asterisks yourself.

So if you want just links and lists, there isn’t a good option for you. You should use Markdown syntax for links I think, given what you want.

You mean outside of the context of Markdown stuff? Because that shouldn’t be happening (unless you have that first checkbox I mentioned ticked). But if you mean can you strip out all formatting from the stock .docx format—not easily. Pretty much the entire kit is built around the notion that people are going to want to keep their italics, etc. The best I can think of off of the top of my head would be to override the font to something that only has a regular variant, like Inconsolata.

When I compile for output, I’m getting an odd character the \ at the beginning of each set of hash tags to create a heading. So, for instance, I’m seeing a \##Heading 2 ##. Is there a way to remove the leading character

The example project I posted doesn’t seem to be doing that out of the .zip, it must be a setting you’ve changed—I’d walk back through those to see what might be the cause.

As a guess, you might have rich text to MMD conversion enabled, which presumes you are using rich text, not MMD headings. You can override that assumption by ticking the Treat as raw markup checkbox for these styles in the Styles pane.

AmberV: “Rich text to Markdown” seems to escape markdown symbols here as well:


I’m not quite sure why this has to happen, it seems like this setting should target the rich text, not unset any existing markdown content (or special Scrivener features like the captions which happen to use a markdown-like symbol)?

There was an update to Scrivener for iOS today where the escaping of # with convert to markdown for plain text was considered a bug, I assume that means this is to?

Because the setting is primarily meant for those wishing to use the Markdown compile options secondarily; where one might be using the native ePub 3 or PDF output for some things, they might also want LaTeX or DocBook without having to modify their entire source document to do so. In cases such as that, one would most likely not be paying attention to special Markdown characters, and any usage of them should be considered verbatim. So all punctuation that might be used to form markup is escaped. If you want to number your paragraphs with #1, #2 then you can do so.

Meanwhile it is easier to escape a character that should be escaped in a Markdown sense. For example if I want to literally print an HTML element like , then I would escape the lesser-than sign to avoid it being interpreted as HTML, like <this>. You wouldn’t want to do that with the native PDF. Hence you can type the element in bare and compile to PDF fine, then switch over to DocBook and have your text properly escaped to print as typed there as well. Going in the other direction would be more awkward.

For those cases, like the above, where you really do mean to use Markdown then that is what the aforementioned Treat as raw markup setting is for. You might also want to hide text styled as raw Markdown in your PDF, which would also be easy to do with styles on a per format basis.

That’s different, but an important distinction worth noting. In that case Scrivener for iOS was escaping its own automatically generated Markdown, in this case the product of the heading switch right above it. You will note that the macOS compiler does not escape its own automatically generated syntax—such as images, headings via Layouts and anything in the MultiMarkdown|Pandoc Options compile pane. It only escapes what we ourselves input.

The above solution is a case of text being entered via our input in that technically speaking, that’s not Scrivener generated Markdown—that’s us telling Scrivener to generate Markdown around a style. It treats style prefix/suffix text as text we have entered ourselves—and escapes it.

So, moral of the story: if you use a mechanism of the compiler to generate Markdown in an otherwise RTF document with the RTF->MMD conversion process enabled, make sure to instruct the compiler to treat it as markup.

As to your linked forum thread specifically—the use of Markdown captions in conjunction with compile settings designed for non-Markdown users to make use of the Markdown workflow—that might not be something we can fix? I’ll see if it is possible since it does make a certain sense, it being a Scrivener feature for captioning, but it’s worth noting that isn’t a global Scrivener feature for captioning—only for Markdown, and hence if you used your source to print a PDF then you would end up with bare brackets—thus Scrivener presuming that is your intention, and is trying to preserve it by escaping them. :slight_smile:

It strives to generate a Markdown text that matches the content when printed via PDF. I’ve added a note to clear this up a bit in the manual.