to-markdown

HTML-to-Markdown converter

to-markdown

An HTML to Markdown converter written in javascript.

A basic implementation is there, but it's not yet fully bulletproof (contributions welcome!).

to-markdown depends on he.js. Include both he.js and to-markdown:

<script src="PATH/TO/he.js"></script>
<script src="PATH/TO/to-markdown.js"></script>

<script>toMarkdown('<h1>Hello world</h1>')</script>
bower install to-markdown
npm install to-markdown

var toMarkdown = require('to-markdown').toMarkdown;
toMarkdown('<h1>Hello world</h1>');

Node.js unit tests can be run with NodeUnit:

$ npm test

This will test both server-side and client-side tests (using zombie-qunit).

There are a couple of known issues surrounding blockquotes in lists (and perhaps vice versa) — #2; and also how to handle HTML elements outside of the markdown subset (keep them/strip them?) — #3.

to-markdown is copyright © 2011-14 Dom Christie and released under the MIT license.