When converting a JSON document (pandoc AST) to Markdown, I get the following error:
97 def _convert(reader, processor, source, to, format=None, extra_args=(), encoding=None,
98 outputfile=None, filters=None):
99 source, format, input_type = reader(source, format, encoding=encoding)
100
101 formats = {
102 'dbk': 'docbook',
103 'md': 'markdown',
104 'rest': 'rst',
105 'tex': 'latex',
106 }
107
108 format = formats.get(format, format)
109 to = formats.get(to, to)
110
111 if not format:
112 raise RuntimeError('Missing format!')
113
114 from_formats, to_formats = get_pandoc_formats()
115
116 if _get_base_format(format) not in from_formats:
117 raise RuntimeError(
118 'Invalid input format! Expected one of these: ' +
119 -> ', '.join(from_formats))
120
121 base_to_format = _get_base_format(to)
122 if base_to_format not in to_formats:
123 raise RuntimeError(
124 'Invalid output format! Expected one of these: ' +
125 ', '.join(to_formats))
126
127 # list from https://github.com/jgm/pandoc/blob/master/pandoc.hs
128 # `[...] where binaries = ["odt","docx","epub","epub3"] [...]`
129 if base_to_format in ["odt", "docx", "epub", "epub3"] and not outputfile:
130 raise RuntimeError(
131 'Output to %s only works by using a outputfile.' % base_to_format
132 )
133
134 return processor(source, input_type, to, format, extra_args,
135 outputfile=outputfile, filters=filters)
(Pdb) p from_formats
['commonmark', 'docbook', 'docx', 'epub', 'haddock', 'html', 'json*', 'latex', 'markdown', 'markdown_github', 'markdown_mmd', 'markdown_phpextra', 'markdown_strict', 'mediawiki', 'native', 'opml', 'org', 'rst', 't2t', 'textile', "twiki [ *only Pandoc's JSON version of native AST]"]