mirror of
https://github.com/showdownjs/showdown.git
synced 2024-03-22 13:30:55 +08:00
fix(gfm-codeblocks): leading space no longer breaks gfm codeblocks
Now GFM Code Blocks can have up to 3 spaces before the backticks Closes #523
This commit is contained in:
parent
26abc7a795
commit
6259f37bd6
|
@ -20,7 +20,7 @@ showdown.subParser('makehtml.githubCodeBlocks', function (text, options, globals
|
|||
|
||||
text += '¨0';
|
||||
|
||||
text = text.replace(/(?:^|\n)(```+|~~~+)(?: *)([^\s`~]*)\n([\s\S]*?)\n\1/g, function (wholeMatch, delim, language, codeblock) {
|
||||
text = text.replace(/(?:^|\n)(?: {0,3})(```+|~~~+)(?: *)([^\s`~]*)\n([\s\S]*?)\n(?: {0,3})\1/g, function (wholeMatch, delim, language, codeblock) {
|
||||
var end = (options.omitExtraWLInCodeBlocks) ? '' : '\n';
|
||||
|
||||
// First parse the github code block
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
<pre><code class="javascript language-javascript">var test = test;
|
||||
function foo() {
|
||||
return 'bar';
|
||||
}
|
||||
</code></pre>
|
||||
<pre><code class="javascript language-javascript">var test = test;
|
||||
function foo() {
|
||||
return 'bar';
|
||||
}
|
||||
</code></pre>
|
||||
<pre><code class="javascript language-javascript">var test = test;
|
||||
function foo() {
|
||||
return 'bar';
|
||||
}
|
||||
</code></pre>
|
|
@ -0,0 +1,20 @@
|
|||
```javascript
|
||||
var test = test;
|
||||
function foo() {
|
||||
return 'bar';
|
||||
}
|
||||
```
|
||||
|
||||
```javascript
|
||||
var test = test;
|
||||
function foo() {
|
||||
return 'bar';
|
||||
}
|
||||
```
|
||||
|
||||
```javascript
|
||||
var test = test;
|
||||
function foo() {
|
||||
return 'bar';
|
||||
}
|
||||
```
|
Loading…
Reference in New Issue
Block a user