This is a utility for converting from reStructuredText mark-up to markdown mark-up.
The tool can be installed via npm
:
$ npm install rst2mdown
Or you can download the .zip or .tar.gz, extract and use.
You can test the installation be using the test script from the root directory:
$ node test
You will require NodeJS installed. To take in a reStructuredText file and output a markdown one, you would run the following command from the root of the install:
$ bin/rst2mdown -i somefile.rst -o somefile.md
Also, the binary version also support stdin
and stdout
:
$ bin/rst2mdown < somefile.rst > somefile.md
And module supports both CommonJS and AMD loading. To load as CommonJS module under node:
var rst2mdown = require('rst2mdown');
var mdown = rst2mdown(someReStructuredText);
Or as an AMD module:
require(['rst2mdown'], function (rst2mdown) {
var mdown = rst2mdown(someReStructuredText);
});
Converting from reStructuredText to markdown is not straight forward. Generally speaking, reStructuredText provides significantly more features than are supportable via markdown. Please refer to the Conversion Notes to understand how particular aspects of the conversion are handled.
This code is licensed under the New BSD License and is Copyright (c) 2012 Kitson P. Kelly.
This code is possible through documentation and concepts from other projects:
- reStructuredText - Markup Syntax for Python docutils project.
- marked - A markdown parser and compiler that is built for speed.
- PHP Markdown Extra - Extension to markdown syntax for PHP Markdown.