diff --git a/bin/marked b/bin/marked index 06781c7882..6a3c2f5eb3 100755 --- a/bin/marked +++ b/bin/marked @@ -41,6 +41,7 @@ function main(argv, callback) { options = {}, input, output, + string, arg, tokens, opt; @@ -86,6 +87,10 @@ function main(argv, callback) { case '--input': input = argv.shift(); break; + case '-s': + case '--string': + string = argv.shift(); + break; case '-t': case '--tokens': tokens = true; @@ -118,6 +123,9 @@ function main(argv, callback) { function getData(callback) { if (!input) { if (files.length <= 2) { + if (string) { + return callback(null, string); + } return getStdin(callback); } input = files.pop(); diff --git a/docs/README.md b/docs/README.md index f5b154276b..c46736c2e5 100644 --- a/docs/README.md +++ b/docs/README.md @@ -49,6 +49,11 @@ $ cat hello.html

hello world

``` +``` bash +$ marked -s "*hello world*" +

hello world

+``` + **Browser** ```html diff --git a/test/unit/marked-spec.js b/test/unit/marked-spec.js index 324dad127b..0bb5b39f6d 100644 --- a/test/unit/marked-spec.js +++ b/test/unit/marked-spec.js @@ -7,15 +7,15 @@ it('should run the test', function () { }); describe('Test heading ID functionality', function() { - it('should add id attribute by default', function() { - var renderer = new marked.Renderer(marked.defaults); - var header = renderer.heading('test', 1, 'test'); - expect(header).toBe('

test

\n'); - }); + it('should add id attribute by default', function() { + var renderer = new marked.Renderer(marked.defaults); + var header = renderer.heading('test', 1, 'test'); + expect(header).toBe('

test

\n'); + }); - it('should NOT add id attribute when options set false', function() { - var renderer = new marked.Renderer({ headerIds: false }); - var header = renderer.heading('test', 1, 'test'); - expect(header).toBe('

test

\n'); - }); + it('should NOT add id attribute when options set false', function() { + var renderer = new marked.Renderer({ headerIds: false }); + var header = renderer.heading('test', 1, 'test'); + expect(header).toBe('

test

\n'); + }); });