Git Product home page Git Product logo

to-markdown's Introduction

to-markdown

An HTML to Markdown converter written in JavaScript.

The API is as follows:

toMarkdown(stringOfHTML, options);

Installation

Browser

Download the compiled script located at dist/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

$ npm install to-markdown

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

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

Options

gfm (boolean)

to-markdown has beta support for GitHub flavored markdown (GFM). Set the gfm option to true:

toMarkdown('<del>Hello world!</del>', { gfm: true });

Development & Contributing

First make sure you have node.js/npm installed, then:

$ npm install --dev
$ bower install --dev

Automatically browserify the module when source files change by running:

$ npm start

Tests

To run the tests in the browser, open test/index.html.

To run in node.js:

$ npm test

Credits

Thanks to all contributors. Also, thanks to Alex Cornejo for advice and inspiration for the breadth-first search algorithm.

Licence

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

to-markdown's People

Contributors

domchristie avatar bergie avatar danfinlay avatar jriquelme avatar rasmusvhansen avatar mathiasbynens avatar stevenweber avatar

Watchers

James Cloos avatar Lareina Ford avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.