0.0.1 • Published 9 years ago

wikitext2markdown v0.0.1

Weekly downloads
1
License
MIT
Repository
-
Last release
9 years ago

wikitext2markdown

Converts wikitext into markdown without going through html. I wrote this to get a very lightweight way to get wikitext (mediawiki format) into a modified form of markdown for later display on the command line.

There are still some issues with this but it works passably well for now.

Note that I wrote this for my own purposes and I am actually stripping a bunch of content that isn't relevant for me, such as links. If you are looking for a more complete converter, you should get the content from the wiki in html and parse it as markdown instead - or convert the wikitext to html and the html to markdown.

Install

npm install wikitext2markdown

Usage

var wiki2md = require('wikitext2markdown');

wiki2md('== header ==');    // ## header
wiki2md('{{Tip|foo bar}}'); // **Tip**: *foo*

For more examples, check the tests

Todo

  • multiline code in the bc template format ({{bc|code}})
  • fix tables with template links in them