Home

Awesome

HTML2Markdown

Javascript implementation for converting HTML to Markdown text. Browser and Node.js support.

Installation

npm install html2markdown

Usage in node.js

var html2markdown = require('html2markdown');

console.log(html2markdown('<h1>Hello markdown!</h1>'));

Usage in browser

<script type="text/javascript" src="markdown_dom_parser.js"></script>
<script type="text/javascript" src="html2markdown.js"></script>

console.log(html2markdown("<h1>Hello markdown!</h1>"))

This call will return convert the html and return the mardown string like ""# H1\n\n"

Changes in this implementation

Known conversion issues

If HTML tag is of following form. Then, currently showdown fails to render

    <a href="/some_link">
        <h1>
                <img src="/some_image_lin"/>
        </h1>
    </a>