mirror of
https://github.com/showdownjs/showdown.git
synced 2024-03-22 13:30:55 +08:00
fix(fenced codeblocks): add tilde as fenced code block delimiter
Closes #456
This commit is contained in:
parent
616a789e79
commit
c956ede4e7
4
dist/showdown.js
vendored
4
dist/showdown.js
vendored
@ -1,4 +1,4 @@
|
||||
;/*! showdown v 1.8.1 - 01-11-2017 */
|
||||
;/*! showdown v 1.8.1 - 11-11-2017 */
|
||||
(function(){
|
||||
/**
|
||||
* Created by Tivie on 13-07-2015.
|
||||
@ -3076,7 +3076,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
|
||||
|
2
dist/showdown.js.map
vendored
2
dist/showdown.js.map
vendored
File diff suppressed because one or more lines are too long
4
dist/showdown.min.js
vendored
4
dist/showdown.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/showdown.min.js.map
vendored
2
dist/showdown.min.js.map
vendored
File diff suppressed because one or more lines are too long
@ -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
|
||||
|
@ -6,3 +6,9 @@
|
||||
<p>And some HTML</p>
|
||||
<pre><code class="html language-html"><div>HTML!</div>
|
||||
</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>
|
||||
|
@ -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
|
||||
~~~
|
||||
|
Loading…
x
Reference in New Issue
Block a user