Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
An HTML to Markdown converter written in JavaScript
branch: master

README.md

to-markdown

An HTML to Markdown converter written in javascript.

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

Usage

Browser

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

bower install to-markdown

Node.js

npm install to-markdown

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

Unit tests

Node.js unit tests can be run with NodeUnit:

$ npm test

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

Known issues

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.

Licence

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

Something went wrong with that request. Please try again.