Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm experimenting with Pandoc, in particular the markdown to RTF function. When I run the converter, the resulting RTF is opened in both Word and OpenOffice as plain text (where the text looks like RTF, but isn't treated as RTF). Converting to HTML works fine.

Here is the command I used:

pandoc -f markdown -t rtf -o sample.rtf sample.txt

Here is the short sample markdown I used:

# markdown example

- uli1

_em_

__strong__

Snippet of the contents of the created file:

{\pard \ql \f0 \sa180 \li0 \fi0 \b \fs36 markdown example\par}

Running on Vista 32-bit, using Pandoc 1.6 (from http://code.google.com/p/pandoc/downloads/list).

Does anyone know what the problem might be?

share|improve this question
up vote 8 down vote accepted

You just need to use the '-s' (or '--standalone') option when invoking pandoc. Otherwise pandoc produces a fragment, not a full standalone RTF file.

share|improve this answer
    
Thanks @John. That's the option I was looking for. I didn't comprehend from the docs how useful it would be. – Ash Dec 21 '10 at 10:50

A rtf file should always begin with the magic number {\rtf (and end in a matching }). Make sure the generated file starts with that. If it doesn't either there is a bug in pandoc or you are missing a setting somewhere.

I tried the web version of Pandoc and it did not add {\rtf at the beginnig of the text.

share|improve this answer
    
Thanks Nifle - that was exactly the problem. After manually wrapping the file in the "magic number" it was loaded properly (I suspect a bug in the converter). Cheers! – Ash Oct 16 '10 at 23:17
    
@Ash - Glad to be of help – Nifle Oct 16 '10 at 23:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .