Browse Source

Merge branch 'hotfix/#191' into develop

Estevão Soares dos Santos 10 years ago
parent
commit
e754668814

+ 4 - 2
dist/showdown.js

@@ -1024,6 +1024,9 @@ showdown.subParser('autoLinks', function (text, options) {
 showdown.subParser('blockGamut', function (text, options, globals) {
 showdown.subParser('blockGamut', function (text, options, globals) {
   'use strict';
   'use strict';
 
 
+  // we parse blockquotes first so that we can have headings and hrs
+  // inside blockquotes
+  text = showdown.subParser('blockQuotes')(text, options, globals);
   text = showdown.subParser('headers')(text, options, globals);
   text = showdown.subParser('headers')(text, options, globals);
 
 
   // Do Horizontal Rules:
   // Do Horizontal Rules:
@@ -1035,7 +1038,6 @@ showdown.subParser('blockGamut', function (text, options, globals) {
   text = showdown.subParser('tables')(text, options, globals);
   text = showdown.subParser('tables')(text, options, globals);
   text = showdown.subParser('lists')(text, options, globals);
   text = showdown.subParser('lists')(text, options, globals);
   text = showdown.subParser('codeBlocks')(text, options, globals);
   text = showdown.subParser('codeBlocks')(text, options, globals);
-  text = showdown.subParser('blockQuotes')(text, options, globals);
 
 
   // We already ran _HashHTMLBlocks() before, in Markdown(), but that
   // We already ran _HashHTMLBlocks() before, in Markdown(), but that
   // was to escape raw HTML in the original Markdown source. This time,
   // was to escape raw HTML in the original Markdown source. This time,
@@ -1064,7 +1066,7 @@ showdown.subParser('blockQuotes', function (text, options, globals) {
    /gm, function(){...});
    /gm, function(){...});
    */
    */
 
 
-  text = text.replace(/((^[ \t]*>[ \t]?.+\n(.+\n)*\n*)+)/gm, function (wholeMatch, m1) {
+  text = text.replace(/((^[ \t]{0,3}>[ \t]?.+\n(.+\n)*\n*)+)/gm, function (wholeMatch, m1) {
     var bq = m1;
     var bq = m1;
 
 
     // attacklab: hack around Konqueror 3.5.4 bug:
     // attacklab: hack around Konqueror 3.5.4 bug:

File diff suppressed because it is too large
+ 0 - 0
dist/showdown.js.map


File diff suppressed because it is too large
+ 0 - 0
dist/showdown.min.js


File diff suppressed because it is too large
+ 0 - 0
dist/showdown.min.js.map


+ 3 - 1
src/subParsers/blockGamut.js

@@ -5,6 +5,9 @@
 showdown.subParser('blockGamut', function (text, options, globals) {
 showdown.subParser('blockGamut', function (text, options, globals) {
   'use strict';
   'use strict';
 
 
+  // we parse blockquotes first so that we can have headings and hrs
+  // inside blockquotes
+  text = showdown.subParser('blockQuotes')(text, options, globals);
   text = showdown.subParser('headers')(text, options, globals);
   text = showdown.subParser('headers')(text, options, globals);
 
 
   // Do Horizontal Rules:
   // Do Horizontal Rules:
@@ -16,7 +19,6 @@ showdown.subParser('blockGamut', function (text, options, globals) {
   text = showdown.subParser('tables')(text, options, globals);
   text = showdown.subParser('tables')(text, options, globals);
   text = showdown.subParser('lists')(text, options, globals);
   text = showdown.subParser('lists')(text, options, globals);
   text = showdown.subParser('codeBlocks')(text, options, globals);
   text = showdown.subParser('codeBlocks')(text, options, globals);
-  text = showdown.subParser('blockQuotes')(text, options, globals);
 
 
   // We already ran _HashHTMLBlocks() before, in Markdown(), but that
   // We already ran _HashHTMLBlocks() before, in Markdown(), but that
   // was to escape raw HTML in the original Markdown source. This time,
   // was to escape raw HTML in the original Markdown source. This time,

+ 1 - 1
src/subParsers/blockQuotes.js

@@ -14,7 +14,7 @@ showdown.subParser('blockQuotes', function (text, options, globals) {
    /gm, function(){...});
    /gm, function(){...});
    */
    */
 
 
-  text = text.replace(/((^[ \t]*>[ \t]?.+\n(.+\n)*\n*)+)/gm, function (wholeMatch, m1) {
+  text = text.replace(/((^[ \t]{0,3}>[ \t]?.+\n(.+\n)*\n*)+)/gm, function (wholeMatch, m1) {
     var bq = m1;
     var bq = m1;
 
 
     // attacklab: hack around Konqueror 3.5.4 bug:
     // attacklab: hack around Konqueror 3.5.4 bug:

+ 9 - 0
test/cases/blockquote-followed-by-code.html

@@ -0,0 +1,9 @@
+<blockquote>
+    <p>a blockquote with a 4 space indented line (not code)</p>
+</blockquote>
+<p>sep</p>
+<blockquote>
+    <p>a blockquote</p>
+</blockquote>
+<pre><code>with some code after
+</code></pre>

+ 8 - 0
test/cases/blockquote-followed-by-code.md

@@ -0,0 +1,8 @@
+> a blockquote
+    with a 4 space indented line (not code)
+
+sep
+
+> a blockquote
+
+    with some code after

+ 8 - 0
test/cases/blockquote-inside-code.html

@@ -0,0 +1,8 @@
+<pre><code>&gt; this is a pseudo blockquote
+    &gt; inside a code block
+</code></pre>
+
+<p>foo</p>
+<pre><code>&gt; this is another bq
+    inside code
+</code></pre>

+ 7 - 0
test/cases/blockquote-inside-code.md

@@ -0,0 +1,7 @@
+    > this is a pseudo blockquote
+    > inside a code block
+
+foo
+
+    > this is another bq
+    inside code

+ 4 - 0
test/issues/#191.blockquote-followed-by-an-heading.html

@@ -0,0 +1,4 @@
+<blockquote>
+    <p>a blockquote</p>
+    <h1 id="followedbyanheading">followed by an heading</h1>
+</blockquote>

+ 2 - 0
test/issues/#191.blockquote-followed-by-an-heading.md

@@ -0,0 +1,2 @@
+> a blockquote
+# followed by an heading

Some files were not shown because too many files changed in this diff