"Convert Rich Text to MultiMarkdown", duplicate file names and "[ref …]"


I’m using Scrivener 3.0.1 and want to compile a document to MultiMarkdown. Let’s say this document has two files with the same name. For example I have two files named “example”.

When “Convert Rich Text to MultiMarkdown” is not checked, both file names are converted to “# example”. If “Convert Rich Text to MultiMarkdown” is checked, the name of the second file is converted to “#example [ref1]”. If there are more files with duplicate names in the document, the number at the end of “ref” is increased.

Is there a way to “Convert Rich Text to MultiMarkdown” without these additions of “[ref …]”?


There are no options tweaking the behaviour of this feature. What is the use case here—why would you want the headings to have colliding IDs?

The use case is this: In my writing I discuss a series of books. I discuss each book in a section with basically the same subsections (“Contents”, “Characters” etc.).

When exporting to Markdown with “Convert Rich Text to MultiMarkdown” checked I get the subsection “Contents” for the first book, “Contents [ref1]” for the second book and so on.

I think I didn‘t make my point clear enough. I don’t want colliding IDs in the headings, I just want the headings in the form I get when “Convert Rich Text to MultiMarkdown” is not checked – without any IDs in them. I’m just surprised to see that behaviour and I thought there would be a configuration option that I just missed.

Okay, just in case it isn’t known then, MultiMarkdown expects you to handle identical headings with custom IDs yourself, otherwise you’ll get invalid documents in cases where it matters—hence why Scrivener strives to avoid creating invalid output since this mode of operation is more designed to achieve some format rather than MMD files as the final stop. Pandoc will generate its own internal IDs for you if it detects a collision (so similar to what Scrivener is doing).

Either way though, you can override Scrivener’s automatic ID by supplying your own. For example:

# Example [bookone-example]

This will also fix Scrivener’s internal automatic cross-referencing if you make use of that. For example if you link to this section from another part of the book, it would create an MMD style link like so:

[hyperlink text][ref1]

And if you override it, then it will use the overridden value:

[hyperlink text][bookone-example]

Thanks for the explanation about the handling of duplicate IDs in pandoc. Before I started to use the “Convert Rich Text to MultiMarkdown”-feature I did all the markdown linking within my document by hand. Since this got a bit tedious I wondered if Scrivener‘s linking features would be helpful for me. And indeed they have been very helpful.

The overriding mechanism seems to be exactly what I need. However, I can’t figure out how to provide my own ID.
Since I don‘t write my heading in markdown but as the name of a file, I don’t seem to be able to provide the ID.

Example: The name of the file is Contents [testid]
Resulting markdown: [code]

Contents [testid]


And Scrivener generates a matching link to that file:

[Link text][Contents][testid]]

Do I have to escape the brackets in the title in some way?

Thanks again for your help!

All right, sorry to say that isn’t supposed to be working. I thought it was given the fact that brackets were not being escaped in the binder titles (normally they would be, so that PDF, RTF, ePub and MMD all look the same), but in fact that’s just an accidental side effect of there being no processing done in the title field at all.

So it looks like you’ll need to stick with the automatically generated serial names.

I guess I‘ll have to find a workaround then.

Thanks again for looking into my issue!