MMD to rtf

Now that I’ve figured out how to get Scrivener to export as MMD (I know, I’m late to the party), I’m wondering if someone can tell me the best way to turn this .txt file into rtf.

I want to keep these two stages separate. After all, I can go straight from Scrivener to rtf.

I’ve used signinstranger’s Perlscript* to turn MMD into .scriv and keep the footnotes, but it doesn’t bring italics etc. with it. Besides, it’s another step.
What I’d like is to be able to archive the MMD files, but also to be able to turn these into rtf if I need to.

I know this has something to do with XSLT or BLT, but it’s not quite time for lunch and I haven’t figured out which sandwich is suited for this job.



This is pretty easy to do, actually—basically just do the same thing Scrivener is doing: call on the RTF script in the MMD distribution. You can find the Perl script in the bin folder under the name By default the RTF file will be dumped to STDOUT, so you’ll need to pipe it to a file.

$ ./ ~/Temp/ > ~/Temp/mmd-File.rtf

If you want more control over the process, read the man page for textutil. This is what the script uses to do the heavy duty conversion from XHTML to RTF; unlike most routes in MMD, the XSLT files are not touched. Hopefully some day we’ll get someone motivated enough about RTF to get a proper XSLT for it. Until then we are stuck with textutil, which is only adequate.

If you have the patience…I need a bit more help.
(The cafe was out of BLT… Must be that.)

Even though I don’t recognize most of the words you use, Amber, I think ‘calling’ means from the Terminal. (?)
And that I need to replace “Temp/” with the name and path of my mmd file.

If this is right so far:

  1. How do I get a .md file? When I export from Scrivener as MMD, I get a .txt file. Does this matter?

  2. How do I let the terminal (or whatever the magician inside is called) know where to find the perl script? Do I need to include that path?

Well. I’m in over my head. I’m sure I’m capable of learning it, but whether you’re patient enough to bother is another question.

You know, I’ve tried to read the How To pages chez Fletcher P., and I’m lost after two sentences…

So. My apologies and thanks.

I hardly ever need this functionality, but I got some good results using latex2rtf and tex4ht with OpenOffice. Both tools have support for footnotes and numbered sections, which makes them indispensable.

Many apologies, I was indeed slipping in to jargon. Yes, this is a function you would type into the Terminal, from the MultiMarkdown/bin folder in Application Support. You would need to supply your own filename as you’ve already guessed. The ones I provided were just for demonstration. It doesn’t matter at all what the extension is. UNIX doesn’t care and you don’t even need an extension. Call it .jpg and it will still work. :slight_smile: In other words, .txt is fine. I change mine in my archives because TextMate does care and loads up the MMD bundle when I open .md files.

A more complete description (the $ in front just indicates a command line, don’t type that in):


$ cd ~/Library/Application\ Support/MultiMarkdown/bin
$ ./ ~/path/to/scrivener_export.txt > ~/path/to/output.rtf

The ~ sign is a special abbreviation for your home folder. It saves having to type out /Users/yourname/ in front of everything.

The > symbol in the middle means “pipe the output to this file”. Be careful with pipes because UNIX doesn’t hold your hand. If your output file already exists it will be destroyed and rewritten without asking. Of course, that can also be useful if you are testing settings.

Here is a nice tip, instead of typing in long paths and filenames, you can drag and drop from the Finder into Terminal at the point where the path needs to be. So if you type in cd and then drop the MultiMarkdown bin directory, you’ll get all of that stuff typed in for you. Same goes for the positions where you put file names (though naturally you’ll have to type in the full path and name for the output file since it wouldn’t exist yet in Finder).

Not a problem. I just kind of assume a level of UNIX familiarity in the MMD section of this forum, so my apologies for skimming over the basics.

It’s going to be easier to use a tool like TextMate or Scrivener to make RTF files, but rest assured both of those applications simply use the MMD toolkit itself and you can manually do all of that magic years later without even own a Mac.

That’s a good point, I forgot about these tools. I hardly ever use this function either as I’d far, far prefer just making a LaTeX generated PDF if I need to share an MMD document. Otherwise I’d probably have 75-80% of an XSLT for my own uses by now.

Wow. Thanks.
This is just the level of explanation I needed. Thank you for taking the time.

This works nearly perfectly: only footnotes come out as a kinda faked. There are numbers where the numbers belong and the corresponding text is appropriately numbered at the bottom of the page, but they’re not really footnotes (not linked). I’ve imported into Mellel—which I’ve done many times with rtf produced by Scrivener—and something’s a bit slanted.

I don’t expect you to have all the answers.
I’ll try to have a look at the textutil qui doit bien être quelque outil de texte, non?

many many thanks.