fix(fenced codeblocks): add tilde as fenced code block delimiter

Closes #456
This commit is contained in:
Estevao Soares dos Santos 2017-11-11 12:29:36 +00:00
parent 616a789e79
commit c956ede4e7
7 changed files with 19 additions and 1 deletions

BIN
dist/showdown.js vendored

Binary file not shown.

BIN
dist/showdown.js.map vendored

Binary file not shown.

BIN
dist/showdown.min.js vendored

Binary file not shown.

Binary file not shown.

View File

@ -20,7 +20,7 @@ showdown.subParser('githubCodeBlocks', function (text, options, globals) {
text += '¨0';
text = text.replace(/(?:^|\n)```(.*)\n([\s\S]*?)\n```/g, function (wholeMatch, 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

View File

@ -6,3 +6,9 @@
<p>And some HTML</p>
<pre><code class="html language-html">&lt;div&gt;HTML!&lt;/div&gt;
</code></pre>
<p>Use more than 3 backticks</p>
<pre><code>some code
</code></pre>
<p>Use tilde as delimiter</p>
<pre><code>another piece of code
</code></pre>

View File

@ -12,3 +12,15 @@ And some HTML
```html
<div>HTML!</div>
```
Use more than 3 backticks
`````
some code
`````
Use tilde as delimiter
~~~
another piece of code
~~~