Giter Club home page Giter Club logo

upndown's Introduction

upndown

Javascript HTML to Markdown converter, for Node.js and the browser.

Live demo here.

About

This library converts HTML documents to Markdown documents.

The Markdown syntax does not offer a syntactic equivalent for every HTML tag, so this conversion is lossy.

upndown is designed to offer a fast, reliable and whitespace perfect conversion for HTML documents that are made up of elements that have an equivalent in the Markdown syntax, making it suited for Markdown WYSIWYG editors.

Install / Usage

Browser

Standard loading

Download the zip archive on github, unzip, copy in your web folder, and in your HTML:

<script type="text/javascript" src="/assets/upndown/lib/htmlparser.min.js"></script>
<script type="text/javascript" src="/assets/upndown/lib/upndown.min.js"></script>
<script type="text/javascript">

    var und = new upndown();
    var markdown = und.convert('<h1>Hello, World !</h1>');
    
    console.log(markdown); // Outputs: # Hello, World !
    
</script>

Using RequireJS

Download the zip archive on github, unzip, copy in your web folder, and in your HTML:

<script type="text/javascript" src="http://requirejs.org/docs/release/2.1.11/minified/require.js"></script>
<script type="text/javascript">

require.config({
    paths: {
        'upndown': '/assets/upndown/lib/upndown.min'
        'htmlparser': '/assets/upndown/lib/htmlparser.min'
    }
});
 
require(['upndown'], function(upndown) {
    var und = new upndown();
    var markdown = und.convert('<h1>Hello, World !</h1>');
    
    console.log(markdown); // Outputs: # Hello, World !
});
</script>

Nodejs

Install

npm install upndown

Use

var upndown = require('upndown');

var und = new upndown();
var markdown = und.convert('<h1>Hello, World !</h1>');

console.log(markdown); // Outputs: # Hello, World !

Test

In the browser

Navigate to test/browser/ inside the upndown folder. Browser tests are executed by QUnit.

Nodejs

To run the tests, simply execute:

npm test

Nodejs tests are executed using mocha.

Maintainer

upndown is produced by Net Gusto. Drop us a line at [email protected]

upndown's People

Contributors

netgusto avatar bergie avatar

Watchers

Sevki avatar James Cloos avatar  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.