Comparing version 0.0.1 to 0.0.2
Usage: rdd [file] [options] | ||
File: | ||
If not specified, tries to find a README file (eg. README.md) in the | ||
If not specified, tries to find a Readme file (eg. README.md) in the | ||
current directory. | ||
@@ -6,0 +6,0 @@ |
{ | ||
"name": "rdd", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Preview your `README.md` locally as it would appear on Github, with changes reflected on-the-fly. Great for Readme Driven Development.", | ||
@@ -15,2 +15,3 @@ "author": "Lim Yuan Qing", | ||
"github-markdown-css": "^2.0.8", | ||
"highlight.js": "^8.6.0", | ||
"nopt": "^3.0.2", | ||
@@ -17,0 +18,0 @@ "open": "0.0.5", |
@@ -7,2 +7,4 @@ # rdd.js [![npm Version](http://img.shields.io/npm/v/rdd.svg?style=flat)](https://www.npmjs.org/package/rdd) [![Build Status](https://img.shields.io/travis/yuanqing/rdd.svg?style=flat)](https://travis-ci.org/yuanqing/rdd) | ||
Requires [Node.js](https://nodejs.org/). | ||
``` | ||
@@ -16,3 +18,3 @@ $ ls | ||
Here we’re using the `-o` flag to open the rendered page in the web browser. The rendered Markdown will be updated automatically whenever we change `README.md`. | ||
Here we’re using the `-o` flag to open our rendered page in the browser. The page will be updated automatically when we change `README.md`. | ||
@@ -25,3 +27,3 @@ ## Usage | ||
File: | ||
If not specified, tries to find a README file (eg. README.md) in the | ||
If not specified, tries to find a Readme file (eg. README.md) in the | ||
current directory. | ||
@@ -43,2 +45,7 @@ | ||
## Known issues | ||
- Syntax highlighting for code blocks (using [Highlight.js](https://github.com/isagalaev/highlight.js)) is slightly different from what Github actually uses | ||
- Does not support [Task Lists](https://help.github.com/articles/writing-on-github/#task-lists) | ||
## Prior art | ||
@@ -45,0 +52,0 @@ |
@@ -9,5 +9,14 @@ 'use strict'; | ||
var shoe = require('shoe'); | ||
var hljs = require('highlight.js'); | ||
var md = new Remarkable('full', { | ||
html: true | ||
html: true, | ||
highlight: function(str, lang) { | ||
if (lang && hljs.getLanguage(lang)) { | ||
try { | ||
return hljs.highlight(lang, str).value; | ||
} catch (err) {} | ||
} | ||
return ''; | ||
} | ||
}); | ||
@@ -19,3 +28,3 @@ | ||
var serve = function(file, port) { | ||
var serve = function(file, port, cb) { | ||
@@ -28,5 +37,13 @@ var server = http.createServer(ecstatic(__dirname)); | ||
gaze(file, function(err, watcher) { | ||
watcher.on('all', function(event, file) { | ||
if (err) { | ||
return cb(err); | ||
} | ||
watcher.on('changed', function() { | ||
render(file, stream); | ||
}); | ||
watcher.on('deleted', function() { | ||
server.close(); | ||
watcher.close(); | ||
cb(file + ': No such file'); | ||
}); | ||
}); | ||
@@ -36,4 +53,6 @@ }); | ||
return server; | ||
}; | ||
module.exports = serve; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
173372
673
59
9
+ Addedhighlight.js@^8.6.0
+ Addedhighlight.js@8.9.1(transitive)