From 77bebf2024a127254f26b9e7375455eeaec6cac7 Mon Sep 17 00:00:00 2001 From: chang-ning Date: Fri, 2 Sep 2016 23:18:20 +0800 Subject: [PATCH] Support Blockquotes :cake: --- lib/slide.js | 20 ++++++++++++++++++++ slides/example.md | 9 ++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/lib/slide.js b/lib/slide.js index 719b430..1113865 100644 --- a/lib/slide.js +++ b/lib/slide.js @@ -192,6 +192,26 @@ TerminalRenderer.prototype.hr = function() { return '\n\n' + '-'.repeat(this.o.width) + '\n'; }; +TerminalRenderer.prototype.blockquote = function(quoteBlocks) { + return Promise.all(quoteBlocks).then(quotes => { + var body = ""; + quotes.forEach(quote => { + body += quote; + }); + body = setLineSameWidth(body.trim()); + + var quote = ""; + body.split('\n').forEach(line => { + if (line.trim() === "") { + quote += '\n'; + return; + } + quote += ('> ' + line + '\n'); + }); + return '\n' + this.o.blockquote(indentify(quote)) + '\n\n'; + }); +}; + /** * Read slide content. diff --git a/slides/example.md b/slides/example.md index 85e5ae1..52f3a07 100644 --- a/slides/example.md +++ b/slides/example.md @@ -6,7 +6,6 @@ All pull requests are welcome! --- - ### Noder JS ### Email: NoderJS@example.com @@ -143,6 +142,14 @@ become | zebra stripes | are neat | $1 | +# Block quote + +> Blockquotes are very handy in email to emulate reply text. +> This line is part of the same quote. + +> Oh, you can put Markdown into a blockquote. + + # Link Markdown