Running Scrivener 3 on Ubuntu 26.04 via CrossOver, I normally compile with Pandoc, with no problems. Today I tried the built-in MultiMarkdown → OpenOffice (.odt) format.
The resulting ODT document prompts an error message in LibreOffice (“The file ‘xxxxx.odt’ is corrupt… Should LibreOffice repair the file?”). After repairing, headings and footnotes come through, but italics/emphasis are gone (and macros deactivated).
However, MMD → .html seems to work well (italics and everything), and compiling into MMD produces a .md file without any apparent issues.
My question is whether MMD → ODT is known to be broken, or if this could be a Linux/Wine/CrossOver issue? A bug perhaps?
I’ve moved this over to the Scrivener > Markdown & LaTeX section since it is a bug exclusively within MultiMarkdown itself rather than any integration with Scrivener, or the environment it is run within (tested macOS, Linux and Windows).
Bunch of geek stuff...
I can reproduce the problem very simply with:
$ echo "This is a test." | multimarkdown -t odt -o ~/test.odt
So of course that is using the Linux version directly, to remove any complexities there.
My second test was to compile to .fodt, which simply exports the XML as a text file any necessary graphics alongside it. LibreOffice can open these files directly, and does so without issue. So it’s not a problem in the XML of the document itself.
My third test was to unzip the .odt file to examine its contents:
$ mkdir odt-tmp; cd odt-tmp
$ unzip ../test.odt
The only slightly odd thing I spotted was an empty Pictures folder not declared in the manifest, but in my testing that wasn’t actually the problem. I did in fact try to fix it that way, by removing the empty folder, and that worked—but that was a red herring.
The solution was to simply re-zip it without any changes made to the internal file structure:
$ mkdir fix-odt; cd fix-odt
$ unzip ../compiled.odt
$ zip -r ../compiled-fix.odt .
So something about how MMD is creating zip files isn’t something LibreOffice likes in more recent builds of LO, would be my guess.
There are two workarounds for you anyway: either use .fodt or build a little script to fix the .odt files by unzipping to a temp folder and then zipping it again.[1]
P.S. I did also clone the repo and try building against both the ‘develop’ and ‘6.8.0’ branch, both of which are newer than the version included with Scrivener, but whatever the problem is, it still persists.
Well, another is of course to use Pandoc! Setting the compile format type to plain “MultiMarkdown”, editing the compile format, and setting up the Processing tab is how you’d automate that from the Scrivener side. ↩︎
I’d treat this first as a possible CrossOver/Wine edge case rather than a confirmed “MMD to ODT is broken” thing, especially since the HTML and raw MMD output look sane. The ODT route depends on the bundled MultiMarkdown conversion chain and then LibreOffice has to be happy with the resulting zipped XML package, so there are a few places for Wine-style weirdness to sneak in. One quick test: compile to MMD, then run the same MultiMarkdown to ODT conversion outside Scrivener if you can, or try opening the file in another ODT reader. Also worth checking whether the compiled ODT is actually a valid zip file. If you can attach a tiny sample project that reproduces it, that would make it much easier to tell whether Scrivener is producing bad ODT or LibreOffice is being fussy.
As I demonstrated in my notes above, this problem can be reproduced with a single command line test (no Scrivener, with native execution of the MMD binary) on three different operating systems (and additionally multimarkdown.exe through Wine). The zip file extracts fine with decompression tools, so it’s not an invalid zip—which is how we can then recompress it with same tools and get it to open in LO with no other content changes.
If you want to see a test of it happen, you don’t need a sample project, it has nothing to do with Scrivener. Just echo some gibberish, pipe it to MMD and have it make it into an ODT: error on load.
I don’t think there are many mysteries on this one to be solved, other than how MMD is zipping the file in a way LO doesn’t like.