Markdown to DOCX conversion bugs


I’ve been writing up my novel using markdown. When compiling I have checked “Convert Markdown to rich text in titles and synopses” and “Convert MultiMarkdown to rich text in notes and text.” I am compiling to DOCX. Mostly works all right but I’ve noticed a few bugs that I do not believe conform to Markdown or MMD syntax.

A. Surrounding underscores (_) converting to underlined text. According to, surrounding underscores should convert to italics. This is also consistent with MMD ( However, this doesn’t concern me so much, as I use asterisks to indicate italicized text. However, it’s an inconsistency I noticed when debugging another problem I found in my document which was:

B. Backslash not escaping md code, cannot produce literal underscore. Originally I was trying to produce a literal underscore two places in my text. On compile, I discovered all text between the two underscores I had used converted to underlined text (this is how I discovered bug A). However, though inserting an escaping backslash to produce a literal underscore (_ as explained in and, this did not correct my problem. Instead, my escaping backslash and underscores both disappeared, and text between remained underlined.

If these are not supported, wouldn’t that mean that Scrivener is working off of a different flavor of Markdown or MultiMarkdown than indicated in the compile settings?

I can reproduce this when compiling for DOCX directly:


Here is a test, to _see_ what *happens* for different \_formatting\_ and so on.

Generates this in Word:

Screenshot 2020-07-15 at 07.39.05_SMALL.png

Scrivener is using its own custom markdown conversion system to convert to RTF.

As a workaround, if you compile using Multimarkdown -> ODT or Pandoc -> DOCX then this all works as expected:

They ended up being minor problems for me in this project, but thanks for confirming. Thought I would mention since Scrivener specifically says it is using MMD in compile it should specify that it is in fact using its own custom flavor

I tried the workaround you mentioned by using Pandoc → DOCX in my compile project format settings but using Pandoc ignores the formatting I had set up in Scrivener .

Yes, all the multimarkdown/pandoc compile options will not represent most RTF formatting you may have, it is a “clean slate” where only the markdown defines the structure (there is a translation option for things like italics, tables etc).

Pandoc uses a template DOCX however, so you can make a Word document as you like (fonts, styles, page/margin structure, headers and footers etc.), then just pass this to Pandoc and it will use this as the base for its output. This means by simply changing templates, you can make the same Scrivener project look completely different. This can give you greater control over DOCX output, and at least for me, I prefer that Scrivener’s editor is fully focussed on content not styling.

Anyway, back to the “bug”, actually this appears to be a “feature”, please read §B7.2 of the user manual, and in Prefs > Sharing you’ll find the option “Convert underscores to underlines when converting Markdown”:

Markdown doesn’t support underlines and so this is added as a feature for conversion. Pandoc has recently added full underline support, but because _ is already used for emphasis, it uses [this format]{.ul} to markup underlines.

As for removing the escaping, this is possibly deliberate, and if so the question is whether this can become another option in the conversion settings if there is a good usecase for it I would imagine?

I can certainly see how supporting underlining is actually better than standard Markdown. I guess my main issue regarding that was that the compiler says it’s translating in MMD so anyone familiar withMMD is exciting a particular behavior. But it’s nice to know I could get underlined text easily if I wanted

The escaping backslash is a much more important issue imo and like you I would love to see that enabled in future updates.