Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge pull request #30 from coolaj86/md2html

add md2html binary
  • Loading branch information...
commit 38d52e89ba8510fe5ad6e0c7c0494de12a0dde6e 2 parents 3e27b67 + d9235f5
Ash Berlin ashb authored

Showing 3 changed files with 49 additions and 0 deletions. Show diff stats Hide diff stats

  1. +14 0 README.markdown
  2. +32 0 bin/md2html.js
  3. +3 0  package.json
14 README.markdown
Source Rendered
@@ -23,6 +23,16 @@ process should actually look, which include:
23 23
24 24 [JsonML]: http://jsonml.org/ "JSON Markup Language"
25 25
  26 +## Installation
  27 +
  28 +Just the `markdown` library:
  29 +
  30 + npm install markdown
  31 +
  32 +Also install `md2html` to `/usr/local/bin` (or wherever)
  33 +
  34 + npm install -g markdown
  35 +
26 36 ## Usage
27 37
28 38 The simple way to use it with CommonJS is:
@@ -39,6 +49,10 @@ and hosted somewhere for nicer browsing.
39 49 We're yet to try it out in a browser, though it's high up on our list of
40 50 things to sort out for this project.
41 51
  52 +### md2html
  53 +
  54 + md2html /path/to/doc.md > /path/to/doc.html
  55 +
42 56 [lib/markdown.js]: http://github.com/evilstreak/markdown-js/blob/master/lib/markdown.js
43 57
44 58 ## Intermediate Representation
32 bin/md2html.js
... ... @@ -0,0 +1,32 @@
  1 +#!/usr/bin/env node
  2 +(function () {
  3 + "use strict";
  4 +
  5 + var fs = require('fs')
  6 + , markdown = require('markdown').markdown
  7 + , fullpath = process.argv[2]
  8 + ;
  9 +
  10 + function convert(err, data) {
  11 + var md
  12 + , html
  13 + ;
  14 +
  15 + if (err) {
  16 + throw err;
  17 + }
  18 +
  19 + md = data.toString('utf8');
  20 + html = markdown.toHTML(md);
  21 + console.log(html);
  22 + }
  23 +
  24 + if (!fullpath) {
  25 + console.error('try: ', process.argv[1].split('/').pop(), '/path/to/doc.md');
  26 + return;
  27 + }
  28 +
  29 + console.log(markdown);
  30 +
  31 + fs.readFile(fullpath, convert);
  32 +}())
3  package.json
@@ -45,5 +45,8 @@
45 45 "name" : "markdown",
46 46 "main" : "./lib/index.js"
47 47 }
  48 + },
  49 + "bin": {
  50 + "md2html": "./bin/md2html.js"
48 51 }
49 52 }

0 comments on commit 38d52e8

Please sign in to comment.
Something went wrong with that request. Please try again.