HTML转Markdown的JS库:to-markdown

d2dn 8年前

采用JavaScript开发的HTML to Markdown转换器。

The API is as follows:

toMarkdown(stringOfHTML, options);

Installation

Browser

Download the compiled script located atdist/to-markdown.js.

<script src="PATH/TO/to-markdown.js"></script>   <script>toMarkdown('<h1>Hello world!</h1>')</script>

Or with Bower:

$ bower install to-markdown
<script src="PATH/TO/bower_components/to-markdown/dist/to-markdown.js"></script>   <script>toMarkdown('<h1>Hello world!</h1>')</script>

Node.js

Install theto-markdownmodule:

$ npm install to-markdown

Then you can use it like below:

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

(Note it is no longer necessary to call.toMarkdownon the required module as of v1.)

项目主页:http://www.open-open.com/lib/view/home/1441870685477