mirror of
https://github.com/showdownjs/showdown.git
synced 2024-03-22 13:30:55 +08:00
Added test case for github codeblock at start of string
This commit is contained in:
parent
6515742ea9
commit
fa38885994
|
@ -910,12 +910,13 @@ var _DoGithubCodeBlocks = function(text) {
|
||||||
var language = m1;
|
var language = m1;
|
||||||
var codeblock = m2;
|
var codeblock = m2;
|
||||||
|
|
||||||
|
console.log('codeblock', '|' + codeblock + '|');
|
||||||
codeblock = _EncodeCode(codeblock);
|
codeblock = _EncodeCode(codeblock);
|
||||||
codeblock = _Detab(codeblock);
|
codeblock = _Detab(codeblock);
|
||||||
codeblock = codeblock.replace(/^\n+/g,""); // trim leading newlines
|
codeblock = codeblock.replace(/^\n+/g,""); // trim leading newlines
|
||||||
codeblock = codeblock.replace(/\n+$/g,""); // trim trailing whitespace
|
codeblock = codeblock.replace(/\n+$/g,""); // trim trailing whitespace
|
||||||
|
|
||||||
codeblock = "<pre><code" + (language ? " class=\"" + language : "\"") + ">" + codeblock + "\n</code></pre>";
|
codeblock = "<pre><code" + (language ? " class=\"" + language + '"' : "") + ">" + codeblock + "\n</code></pre>";
|
||||||
|
|
||||||
return hashBlock(codeblock);
|
return hashBlock(codeblock);
|
||||||
}
|
}
|
||||||
|
|
7
test/cases/github-style-at-start.html
Normal file
7
test/cases/github-style-at-start.html
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
|
||||||
|
<pre><code>function MyFunc(a) {
|
||||||
|
// ...
|
||||||
|
}
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>That is some code!</p>
|
7
test/cases/github-style-at-start.md
Normal file
7
test/cases/github-style-at-start.md
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
```
|
||||||
|
function MyFunc(a) {
|
||||||
|
// ...
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
That is some code!
|
Loading…
Reference in New Issue
Block a user