From a989b5ccde0dfb18b1a167d101325082c968a0c3 Mon Sep 17 00:00:00 2001 From: Gilles De Mey Date: Tue, 15 Sep 2015 19:10:53 +0200 Subject: [PATCH 1/3] fall back to using the default mermaid style --- lib/cli.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/cli.js b/lib/cli.js index e2506e4bda..d899ee039e 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -109,6 +109,8 @@ cli.prototype.parse = function(argv, next) { } catch (err) { this.errors.push(err) } + } else { + options.css = fs.readFileSync(__dirname + '/../dist/mermaid.css') } this.checkPhantom = createCheckPhantom(options.phantomPath) From b04f198f3eb5a54a36c980edd35b30eeb0f25059 Mon Sep 17 00:00:00 2001 From: Gilles De Mey Date: Tue, 15 Sep 2015 19:11:05 +0200 Subject: [PATCH 2/3] auto width for the default style --- dist/mermaid.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/mermaid.css b/dist/mermaid.css index f997400f70..ad2674b4a8 100644 --- a/dist/mermaid.css +++ b/dist/mermaid.css @@ -256,5 +256,5 @@ text { } .mermaid { - width:1200px; + width: auto; } From 85481b2310ef3570b637ad04909b8dde39e0117e Mon Sep 17 00:00:00 2001 From: Gilles De Mey Date: Tue, 15 Sep 2015 19:22:07 +0200 Subject: [PATCH 3/3] Added test for using a default style --- test/cli_test-parser.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/cli_test-parser.js b/test/cli_test-parser.js index be03bebe1d..ab913478f5 100644 --- a/test/cli_test-parser.js +++ b/test/cli_test-parser.js @@ -71,6 +71,17 @@ test('setting an output directory succeeds', function(t) { }) }) +test('not setting a css source file uses a default style', function(t) { + t.plan(1) + + var cli = require(cliPath) + + cli.parse([], function(err, msg, opt) { + t.ok(opt.css, 'css file is populated') + t.end() + }) +}) + test('setting a css source file succeeds', function(t) { t.plan(1)