Javascript HTML to Markdown converter, for Node.js and the browser.
upndown converts HTML documents to Markdown documents.
upndown is designed to offer a fast, reliable and whitespace perfect conversion for HTML documents.
Standard loading
Download the zip archive on github, unzip, copy in your web folder, and in your HTML:
<script type="text/javascript" src="/assets/upndown/lib/upndown.bundle.min.js"></script>
<script type="text/javascript">
var und = new upndown();
und.convert('<h1>Hello, World !</h1>', function(err, markdown) {
if(err) { console.err(err);
else { console.log(markdown); } // Outputs: # Hello, World !
});
</script>
Using RequireJS
Download the zip archive on github, unzip, copy in your web folder, and in your HTML:
<script type="text/javascript" src="http://requirejs.org/docs/release/2.1.11/minified/require.js"></script>
<script type="text/javascript">
require.config({
paths: {
'upndown': '/assets/upndown/lib/upndown.bundle.min'
}
});
require(['upndown'], function(upndown) {
var und = new upndown();
und.convert('<h1>Hello, World !</h1>', function(err, markdown) {
if(err) { console.err(err);
else { console.log(markdown); } // Outputs: # Hello, World !
});
});
</script>
Install
npm install upndown
Use
var upndown = require('upndown');
var und = new upndown();
und.convert('<h1>Hello, World !</h1>', function(err, markdown) {
if(err) { console.err(err);
else { console.log(markdown); } // Outputs: # Hello, World !
});
Navigate to test/browser/
inside the upndown folder. Browser tests are executed by QUnit.
To run the tests, simply execute:
npm test
Nodejs tests are executed using mocha.
upndown is produced by Net Gusto. Drop us a line at [email protected]