mirror of
https://github.com/showdownjs/showdown.git
synced 2024-03-22 13:30:55 +08:00
fix(blockGamut): fix for headings inside blockquotes
The spec states that you can be lazy and only put the `>` before the first line of a hard-wrapped paragraph. It also states that blocquotes can contain any other md element inside. This means headings and horizontal rules should be included in the blockquote but, right now, are treated as independent entities Closes #191
This commit is contained in:
parent
7dc3fb1d25
commit
3df706248f
8
dist/showdown.js
vendored
8
dist/showdown.js
vendored
@ -1,4 +1,4 @@
|
||||
;/*! showdown 11-08-2015 */
|
||||
;/*! showdown 23-08-2015 */
|
||||
(function(){
|
||||
/**
|
||||
* Created by Tivie on 13-07-2015.
|
||||
@ -1029,6 +1029,9 @@ showdown.subParser('autoLinks', function (text, options) {
|
||||
showdown.subParser('blockGamut', function (text, options, globals) {
|
||||
'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);
|
||||
|
||||
// Do Horizontal Rules:
|
||||
@ -1040,7 +1043,6 @@ showdown.subParser('blockGamut', function (text, options, globals) {
|
||||
text = showdown.subParser('tables')(text, options, globals);
|
||||
text = showdown.subParser('lists')(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
|
||||
// was to escape raw HTML in the original Markdown source. This time,
|
||||
@ -1069,7 +1071,7 @@ showdown.subParser('blockQuotes', function (text, options, globals) {
|
||||
/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;
|
||||
|
||||
// attacklab: hack around Konqueror 3.5.4 bug:
|
||||
|
2
dist/showdown.js.map
vendored
2
dist/showdown.js.map
vendored
File diff suppressed because one or more lines are too long
4
dist/showdown.min.js
vendored
4
dist/showdown.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/showdown.min.js.map
vendored
2
dist/showdown.min.js.map
vendored
File diff suppressed because one or more lines are too long
@ -5,6 +5,9 @@
|
||||
showdown.subParser('blockGamut', function (text, options, globals) {
|
||||
'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);
|
||||
|
||||
// Do Horizontal Rules:
|
||||
@ -16,7 +19,6 @@ showdown.subParser('blockGamut', function (text, options, globals) {
|
||||
text = showdown.subParser('tables')(text, options, globals);
|
||||
text = showdown.subParser('lists')(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
|
||||
// was to escape raw HTML in the original Markdown source. This time,
|
||||
|
@ -14,7 +14,7 @@ showdown.subParser('blockQuotes', function (text, options, globals) {
|
||||
/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;
|
||||
|
||||
// attacklab: hack around Konqueror 3.5.4 bug:
|
||||
|
9
test/cases/blockquote-followed-by-code.html
Normal file
9
test/cases/blockquote-followed-by-code.html
Normal file
@ -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
test/cases/blockquote-followed-by-code.md
Normal file
8
test/cases/blockquote-followed-by-code.md
Normal file
@ -0,0 +1,8 @@
|
||||
> a blockquote
|
||||
with a 4 space indented line (not code)
|
||||
|
||||
sep
|
||||
|
||||
> a blockquote
|
||||
|
||||
with some code after
|
8
test/cases/blockquote-inside-code.html
Normal file
8
test/cases/blockquote-inside-code.html
Normal file
@ -0,0 +1,8 @@
|
||||
<pre><code>> this is a pseudo blockquote
|
||||
> inside a code block
|
||||
</code></pre>
|
||||
|
||||
<p>foo</p>
|
||||
<pre><code>> this is another bq
|
||||
inside code
|
||||
</code></pre>
|
7
test/cases/blockquote-inside-code.md
Normal file
7
test/cases/blockquote-inside-code.md
Normal file
@ -0,0 +1,7 @@
|
||||
> this is a pseudo blockquote
|
||||
> inside a code block
|
||||
|
||||
foo
|
||||
|
||||
> this is another bq
|
||||
inside code
|
4
test/issues/#191.blockquote-followed-by-an-heading.html
Normal file
4
test/issues/#191.blockquote-followed-by-an-heading.html
Normal file
@ -0,0 +1,4 @@
|
||||
<blockquote>
|
||||
<p>a blockquote</p>
|
||||
<h1 id="followedbyanheading">followed by an heading</h1>
|
||||
</blockquote>
|
2
test/issues/#191.blockquote-followed-by-an-heading.md
Normal file
2
test/issues/#191.blockquote-followed-by-an-heading.md
Normal file
@ -0,0 +1,2 @@
|
||||
> a blockquote
|
||||
# followed by an heading
|
Loading…
x
Reference in New Issue
Block a user