2nd image in MMD export breaks Scrivener image link

I am exporting a section of my document to MMD -> ODF. I reference images using the following syntax:

Blurg, some text

[pic1]: scrivener_link_to_image

![Testing pic 1][pic1]

The above works fine. Note the text “scrivener_link_to_image” is an actual scrivener link. But when I add a second image, as follows:

Blurg, some text

[pic1]: scrivener_link_to_image

![Testing pic 1][pic1]

Blurg, more text

[pic2]: scrivener_link_to_image2

![Testing pic 2][pic2]

The export MMD->ODF breaks (the image appears in the document but I can see some of the markup that should have been replaced by the image and I lose the caption). The problem is clearly in the MMD being generated, as I see the following when I export to MMD:

Base Header Level: 1  

Blurg, some text

[pic1]: ![][pic1_file]

![Testing pic 1][pic1]

Blurg, more text

[pi![][pic2_file]_file

![Testing pic 2][pic2]

[pic1_file]: pic1_file.jpg

[pic2_file]: pic2_file.jpg

I have just updated to Scrivener for Windows 1.2.3.0, but had the same problem with what I had before the upgrade (I think 1.2.2).

That’s correct, this is a known bug that is in the list of things to fix. The way the feature is documented is the way it should work. The text within the Scrivener link should be replaced with the image name, with extension, and nothing else so that you can manage your own syntax. You can also just drop images into the editor and it will generate syntax for you.

The bug still exists in v1.2.5.0, right?

Yes, have you not updated to .5 yet? You should as there were a number of bugs fixed.

Thanks for the information! Yes, I have updated Scrivener already. But I didn’t know about this bug before. A colleague of mine and me were just figuring out today how to deal with figures (with references and captions) for the mmd latex export… we were trying several approaches and have been got confused in between… ;-(

Yeah, sorry for this bug. It removes the most flexible option from the software, if you need to handle things more precisely. Just dropping the graphic into the editor does work fine, however, so there are ways. Another thing you can do is of course what anyone would normally do with MultiMarkdown, and that is to link to the graphic as it exists on your disk somewhere. So collect all of the figures into one place and link to them in a fashion that will work relatively to where you compile. For instance, if you put all of the graphics into a folder called “fig” and then compile the MMD/HTML/whatever file beside that folder, you could reference everything in the document as This.