mirror of
https://github.com/showdownjs/showdown.git
synced 2024-03-22 13:30:55 +08:00
Enable Github code blocks inside block quotes.
This commit is contained in:
parent
b81c416a31
commit
792a2aa7d6
|
@ -25,6 +25,7 @@ showdown.subParser('blockQuotes', function (text, options, globals) {
|
||||||
bq = bq.replace(/~0/g, '');
|
bq = bq.replace(/~0/g, '');
|
||||||
|
|
||||||
bq = bq.replace(/^[ \t]+$/gm, ''); // trim whitespace-only lines
|
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 = showdown.subParser('blockGamut')(bq, options, globals); // recurse
|
||||||
|
|
||||||
bq = bq.replace(/(^|\n)/g, '$1 ');
|
bq = bq.replace(/(^|\n)/g, '$1 ');
|
||||||
|
|
15
test/cases/github-style-codeblock-inside-quote.html
Normal file
15
test/cases/github-style-codeblock-inside-quote.html
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
<blockquote>
|
||||||
|
<p>Define a function in javascript:</p>
|
||||||
|
|
||||||
|
<pre><code>function MyFunc(a) {
|
||||||
|
var s = '`';
|
||||||
|
}
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<blockquote>
|
||||||
|
<p>And some nested quote</p>
|
||||||
|
|
||||||
|
<pre><code class="html language-html"><div>HTML!</div>
|
||||||
|
</code></pre>
|
||||||
|
</blockquote>
|
||||||
|
</blockquote>
|
13
test/cases/github-style-codeblock-inside-quote.md
Normal file
13
test/cases/github-style-codeblock-inside-quote.md
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
> Define a function in javascript:
|
||||||
|
>
|
||||||
|
> ```
|
||||||
|
> function MyFunc(a) {
|
||||||
|
> var s = '`';
|
||||||
|
> }
|
||||||
|
> ```
|
||||||
|
>
|
||||||
|
>> And some nested quote
|
||||||
|
>>
|
||||||
|
>> ```html
|
||||||
|
>> <div>HTML!</div>
|
||||||
|
>> ```
|
Loading…
Reference in New Issue
Block a user