58

The requirement is that I need to paste a long document in markdown format to a mediawiki site, which has no markdown extension installed. All I can find about markdown, tools or modules/libraries, are in charge of converting markdown to HTML. My question is: is there a convenient way to do the work from markdown to MediaWiki wikitext?

André Levy
  • 280
  • 2
  • 13
jfding
  • 635
  • 1
  • 7
  • 8

1 Answers1

87

Try Pandoc, a universal document converter:

$ pandoc --help
pandoc [OPTIONS] [FILES]
Input formats:  docbook, haddock, html, json, latex, markdown, markdown_github,
                markdown_mmd, markdown_phpextra, markdown_strict, mediawiki,
                native, opml, rst, textile
Output formats: asciidoc, beamer, context, docbook, docx, dzslides, epub, epub3,
                fb2, html, html5, json, latex, man, markdown, markdown_github,
                markdown_mmd, markdown_phpextra, markdown_strict, mediawiki,
                native, odt, opendocument, opml, org, pdf*, plain, revealjs,
                rst, rtf, s5, slideous, slidy, texinfo, textile

It's available for virtually every platform.

Camille Goudeseune
  • 2,934
  • 2
  • 35
  • 56
applicative
  • 8,081
  • 35
  • 38
  • 17
    $ pandoc -r textile input.text -t mediawiki -o output.wiki – rogerdpack Jun 13 '11 at 19:14
  • When I used Pandoc to convert from reStructuredText to MediaWiki, I found that it converted footnotes/references to tags which required a particular MediaWiki plugin I didn't have. I'm not sure what other assumptions it might make about your MediaWiki install. It also didn't seem to process explicit links to section titles (e.g. "`Section title`_") properly. – doshea May 14 '15 at 09:44
  • Pandoc doesn't convert Markdown to Wikipedia very successfully as doshea notes. A pity there isn't a better, real world suggestion. – Foliovision May 06 '20 at 16:09
  • This worked for me: `pandoc input.md -t mediawiki -o output.wiki ` – christopherbalz May 11 '20 at 21:04
  • Had some issues with smart quotes, which is [apparently weird with Markdown](https://pandoc.org/MANUAL.html#typography). When I specified [CommonMark](https://commonmark.org/) as the "from" format, that resolved (though ellipses are still an issue): `pandoc -f commonmark markdownfile.md -t mediawiki -o out.wiki` – ruffin Nov 04 '20 at 15:50