From 792a2aa7d65d5c64c03415ce6ba58c5580ff0b54 Mon Sep 17 00:00:00 2001 From: Philipp Wolfer Date: Tue, 25 Aug 2015 17:35:56 +0200 Subject: [PATCH] Enable Github code blocks inside block quotes. --- src/subParsers/blockQuotes.js | 1 + .../github-style-codeblock-inside-quote.html | 15 +++++++++++++++ test/cases/github-style-codeblock-inside-quote.md | 13 +++++++++++++ 3 files changed, 29 insertions(+) create mode 100644 test/cases/github-style-codeblock-inside-quote.html create mode 100644 test/cases/github-style-codeblock-inside-quote.md diff --git a/src/subParsers/blockQuotes.js b/src/subParsers/blockQuotes.js index 4b1782f..9aa0115 100644 --- a/src/subParsers/blockQuotes.js +++ b/src/subParsers/blockQuotes.js @@ -25,6 +25,7 @@ showdown.subParser('blockQuotes', function (text, options, globals) { bq = bq.replace(/~0/g, ''); bq = bq.replace(/^[ \t]+$/gm, ''); // trim whitespace-only lines + bq = showdown.subParser('githubCodeBlocks')(bq, options, globals); bq = showdown.subParser('blockGamut')(bq, options, globals); // recurse bq = bq.replace(/(^|\n)/g, '$1 '); diff --git a/test/cases/github-style-codeblock-inside-quote.html b/test/cases/github-style-codeblock-inside-quote.html new file mode 100644 index 0000000..85fa51c --- /dev/null +++ b/test/cases/github-style-codeblock-inside-quote.html @@ -0,0 +1,15 @@ +
+

Define a function in javascript:

+ +
function MyFunc(a) {
+  var s = '`';
+  }
+
+ +
+

And some nested quote

+ +
<div>HTML!</div>
+
+
+
diff --git a/test/cases/github-style-codeblock-inside-quote.md b/test/cases/github-style-codeblock-inside-quote.md new file mode 100644 index 0000000..23c4714 --- /dev/null +++ b/test/cases/github-style-codeblock-inside-quote.md @@ -0,0 +1,13 @@ +> Define a function in javascript: +> +> ``` +> function MyFunc(a) { +> var s = '`'; +> } +> ``` +> +>> And some nested quote +>> +>> ```html +>>
HTML!
+>> ```