blob: 96b5c82ade8517018b3bb5381a8a026123c3b4d7 [file] [log] [blame]
Spencer Seidelf7100652017-09-06 12:39:15 -04001Converting to RST
2=================
3
4Installing pandoc
5-----------------
6
7Pandoc is a powerful document-transformation utility. We'll use it to do simple conversions, but it is capable of much more. Visit the `pandoc website <http://pandoc.org/installing.html>`_ for installation instructions for your platform.
8
9Converting
10----------
11
12Using a terminal, navigate to the directory containing the documents you wish to convert. Next, issue the following command for each file you'd like to convert:
13
14:code:`pandoc -s --toc -f <from format> -t rst myfile.<from format>`
15
16:code:`-s` tells pandoc to produce a standalone document
17
18:code:`--toc` tells pandoc to produce a table of contents (optional)
19
20:code:`-t` tells pandoc to produce reStructuredText output
21
22:code:`-f` tells pandoc the input format. It should be one of the following:
23
24+--------------------+---------------------------------------------------------------+
25| Format | Description |
26+====================+===============================================================+
27|commonmark | Markdown variant |
28+--------------------+---------------------------------------------------------------+
29|docbook | XML-based markup |
30+--------------------+---------------------------------------------------------------+
31|docx | Microsoft Word |
32+--------------------+---------------------------------------------------------------+
33|epub | Ebook format |
34+--------------------+---------------------------------------------------------------+
35|haddock | Doc format produced by tool used on Haskell code |
36+--------------------+---------------------------------------------------------------+
37|html | HTML |
38+--------------------+---------------------------------------------------------------+
39|json | JSON pandoc AST |
40+--------------------+---------------------------------------------------------------+
41|latex | Older typesetting syntax |
42+--------------------+---------------------------------------------------------------+
43|markdown | Simple formatting syntax meant to produce HTML |
44+--------------------+---------------------------------------------------------------+
45|markdown_github | Github flavored markdown |
46+--------------------+---------------------------------------------------------------+
47|markdown_mmd | Multi-markdown flavored markdown |
48+--------------------+---------------------------------------------------------------+
49|markdown_phpextra | PHP flavored markdown |
50+--------------------+---------------------------------------------------------------+
51|markdown_strict | Markdown with no added pandoc features |
52+--------------------+---------------------------------------------------------------+
53|mediawiki | Popular wiki language |
54+--------------------+---------------------------------------------------------------+
55|native | Pandoc native Haskell |
56+--------------------+---------------------------------------------------------------+
57|odt | Open document text (used by LibreOffice) |
58+--------------------+---------------------------------------------------------------+
59|opml | Outline processor markup language |
60+--------------------+---------------------------------------------------------------+
61|org | Org mode for Emacs |
62+--------------------+---------------------------------------------------------------+
63|rst | reStructuredText |
64+--------------------+---------------------------------------------------------------+
65|t2t | Wiki-like formatting syntax |
66+--------------------+---------------------------------------------------------------+
67|textile | A formatting syntax similar to RST and markdown |
68+--------------------+---------------------------------------------------------------+
69|twiki | Popular wiki formatting syntax |
70+--------------------+---------------------------------------------------------------+
71
72Fixing the converted document
73-----------------------------
74
75How much you'll need to fix the converted document depends on which file format you're converting from. Here are a couple of things to watch out for:
76
771. Multi-line titles need to be converted to single line
782. Standalone "**" characters
793. :code:`***bolded***` should be :code:`**bolded**`
804. Mangled tables
81
82Previewing edits
83----------------
84
85Web-based
86~~~~~~~~~
87
88`rst.ninjs.org <http://rst.ninjs.org>`_ has an excellent RST previewing tool that highlights RST errors with line numbers.
89
90
91