From 0dcb02f643d9a6bb50822a88162e7d8d6d6ee9b1 Mon Sep 17 00:00:00 2001 From: Tony Brix Date: Wed, 28 Mar 2018 10:18:33 -0500 Subject: [PATCH 1/4] allow string arg --- bin/marked | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bin/marked b/bin/marked index 06781c7882..f26b31bcb4 100755 --- a/bin/marked +++ b/bin/marked @@ -86,6 +86,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; @@ -116,6 +120,9 @@ function main(argv, callback) { } function getData(callback) { + if (string) { + return callback(null, string); + } if (!input) { if (files.length <= 2) { return getStdin(callback); From f03a576063d383993cf71c57f844444e2a85d6ae Mon Sep 17 00:00:00 2001 From: Tony Brix Date: Wed, 28 Mar 2018 10:41:02 -0500 Subject: [PATCH 2/4] prefer input --- bin/marked | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/marked b/bin/marked index f26b31bcb4..57583809c6 100755 --- a/bin/marked +++ b/bin/marked @@ -120,11 +120,11 @@ function main(argv, callback) { } function getData(callback) { - if (string) { - return callback(null, string); - } if (!input) { if (files.length <= 2) { + if (string) { + return callback(null, string); + } return getStdin(callback); } input = files.pop(); From e0fd00bec4442ed130f902d2c34c25ced7e1bb52 Mon Sep 17 00:00:00 2001 From: Tony Brix Date: Sun, 1 Apr 2018 23:25:53 -0500 Subject: [PATCH 3/4] add doc example --- docs/README.md | 5 +++++ 1 file changed, 5 insertions(+) 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 From 25c456a5e7c3a953e2c7a302e33efce365597680 Mon Sep 17 00:00:00 2001 From: Tony Brix Date: Thu, 5 Apr 2018 00:00:08 -0500 Subject: [PATCH 4/4] lint --- bin/marked | 1 + test/unit/marked-spec.js | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/bin/marked b/bin/marked index 57583809c6..6a3c2f5eb3 100755 --- a/bin/marked +++ b/bin/marked @@ -41,6 +41,7 @@ function main(argv, callback) { options = {}, input, output, + string, arg, tokens, opt; 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'); + }); });