Parcourir la source

Merge branch 'develop' of https://github.com/showdownjs/showdown into develop

# Conflicts:
#	dist/showdown.js
#	dist/showdown.js.map
#	dist/showdown.min.js
#	dist/showdown.min.js.map
Estevao Soares dos Santos il y a 6 ans
Parent
commit
0c6b5bdc4b

+ 1 - 1
dist/showdown.js

@@ -2868,7 +2868,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)(```+|~~~+)(?: *)([^\s`~]*)\n([\s\S]*?)\n\1/g, function (wholeMatch, delim, language, codeblock) {
     var end = (options.omitExtraWLInCodeBlocks) ? '' : '\n';
 
     // First parse the github code block

Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
dist/showdown.js.map


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
dist/showdown.min.js


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
dist/showdown.min.js.map


+ 1 - 1
src/subParsers/makehtml/githubCodeBlocks.js

@@ -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)(```+|~~~+)(?: *)([^\s`~]*)\n([\s\S]*?)\n\1/g, function (wholeMatch, delim, language, codeblock) {
     var end = (options.omitExtraWLInCodeBlocks) ? '' : '\n';
 
     // First parse the github code block

+ 5 - 0
test/functional/makehtml/cases/standard/github-style-codeblock.html

@@ -6,6 +6,11 @@
 <p>And some HTML</p>
 <pre><code class="html language-html">&lt;div&gt;HTML!&lt;/div&gt;
 </code></pre>
+<p>And some CSS with spaces before the language declaration</p>
+<pre><code class="css language-css">body {
+font-size: 1.5em;
+}
+</code></pre>
 <p>Use more than 3 backticks</p>
 <pre><code>some code
 </code></pre>

+ 8 - 0
test/functional/makehtml/cases/standard/github-style-codeblock.md

@@ -13,6 +13,14 @@ And some HTML
 <div>HTML!</div>
 ```
 
+And some CSS with spaces before the language declaration
+
+```    css
+body {
+    font-size: 1.5em;
+}
+```
+
 Use more than 3 backticks
 
 `````

Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff