Are there any tools to convert markdown to Wiki text in other formats
Asked Answered
C

1

61

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?

Cleveland answered 24/8, 2010 at 8:17 Comment(0)
D
93

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.

Dumyat answered 26/9, 2010 at 4:36 Comment(5)
$ pandoc -r textile input.text -t mediawiki -o output.wikiUptake
When I used Pandoc to convert from reStructuredText to MediaWiki, I found that it converted footnotes/references to <ref> 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.Budwig
Pandoc doesn't convert Markdown to Wikipedia very successfully as doshea notes. A pity there isn't a better, real world suggestion.Petuntse
This worked for me: pandoc input.md -t mediawiki -o output.wiki Bourdon
Had some issues with smart quotes, which is apparently weird with Markdown. When I specified CommonMark as the "from" format, that resolved (though ellipses are still an issue): pandoc -f commonmark markdownfile.md -t mediawiki -o out.wikiExalt

© 2022 - 2024 — McMap. All rights reserved.