22

I have a doc as an .rst file, how is it possible to easily and fully convert it to .md? I found a tool named pandoc, but it does not correctly convert the file. It works like

pandoc about.rst -s -o about.md 

Are there any available tools?

James Ray
  • 424
  • 3
  • 15
Armen Arzumanyan
  • 1,939
  • 3
  • 30
  • 56
  • 2
    What specifically does not convert correctly? – Steve Piercy Aug 11 '17 at 11:38
  • I have warnings like [pandoc warning] ignoring unknown directive: toctree "source" , and some files lost part of content. – Armen Arzumanyan Aug 11 '17 at 13:00
  • 2
    Markdown supports is only a limited subset of HTML. Therefore, it cannot represent everything from other markup languages. If you want to convert to Markdown, then the source document can only contain features supported by Markdown. There may be workarounds, but for us to help, you will need to provide specific information regarding the errors you are receiving and what input is generating those errors. – Waylan Aug 11 '17 at 14:35

1 Answers1

29

First the syntax for using pandoc is:

pandoc [options] [input-file]…

You did this:

pandoc [input-file] [options]…

To correct it, do this:

pandoc -s -o about.md about.rst

As @Waylan mentioned in their comment, Markdown supports a small subset of reStructuredText features. Pandoc, however, provides an extended version of Markdown which can be enabled through extensions. This might resolve some of your errors, but not others.

Ultimately you will need to edit your question to improve it (don't reply with a comment) with the full error stack for further assistance.

Steve Piercy
  • 13,693
  • 1
  • 44
  • 57
  • The first file name is the output file. This is confusing because you write : `pandoc [options] [input-file]`. It is this way: `pandoc -o [output-file] [input-file]` – Franz Holzinger Feb 09 '23 at 16:55
  • @FranzHolzinger `-o` *is* an option. Without specifying that option, output goes to stdout by default. – Steve Piercy Jul 31 '23 at 20:12