Merge branch 'develop'

This commit is contained in:
Estevao Soares dos Santos 2022-02-25 01:11:13 +00:00
commit 16ad404b85
11 changed files with 148 additions and 18 deletions

48
dist/showdown.js vendored
View File

@ -1,4 +1,4 @@
;/*! showdown v 2.0.0-alpha1 - 24-02-2022 */
;/*! showdown v 2.0.0-alpha1 - 25-02-2022 */
(function(){
/**
* Created by Tivie on 13-07-2015.
@ -4450,14 +4450,14 @@ showdown.subParser('makehtml.lists', function (text, options, globals) {
return '¨A' + wm2;
});
// SPECIAL CASE: an heading followed by a paragraph of text that is not separated by a double newline
// SPECIAL CASE: a heading followed by a paragraph of text that is not separated by a double newline
// or/nor indented. ex:
//
// - # foo
// bar is great
//
// While this does now follow the spec per se, not allowing for this might cause confusion since
// header blocks don't need double newlines after
// header blocks don't need double-newlines after
if (/^#+.+\n.+/.test(item)) {
item = item.replace(/^(#+.+)$/m, '$1\n');
}
@ -4466,7 +4466,47 @@ showdown.subParser('makehtml.lists', function (text, options, globals) {
// Has a double return (multi paragraph)
if (m1 || (item.search(/\n{2,}/) > -1)) {
item = showdown.subParser('makehtml.githubCodeBlocks')(item, options, globals);
item = showdown.subParser('makehtml.blockGamut')(item, options, globals);
item = showdown.subParser('makehtml.blockQuotes')(item, options, globals);
item = showdown.subParser('makehtml.headers')(item, options, globals);
item = showdown.subParser('makehtml.lists')(item, options, globals);
item = showdown.subParser('makehtml.codeBlocks')(item, options, globals);
item = showdown.subParser('makehtml.tables')(item, options, globals);
item = showdown.subParser('makehtml.hashHTMLBlocks')(item, options, globals);
//item = showdown.subParser('makehtml.paragraphs')(item, options, globals);
// TODO: This is a copy of the paragraph parser
// This is a provisory fix for issue #494
// For a permanente fix we need to rewrite the paragraph parser, passing the unhashify logic outside
// so that we can call the paragraph parser without accidently unashifying previously parsed blocks
// Strip leading and trailing lines:
item = item.replace(/^\n+/g, '');
item = item.replace(/\n+$/g, '');
var grafs = item.split(/\n{2,}/g),
grafsOut = [],
end = grafs.length; // Wrap <p> tags
for (var i = 0; i < end; i++) {
var str = grafs[i];
// if this is an HTML marker, copy it
if (str.search(/¨([KG])(\d+)\1/g) >= 0) {
grafsOut.push(str);
// test for presence of characters to prevent empty lines being parsed
// as paragraphs (resulting in undesired extra empty paragraphs)
} else if (str.search(/\S/) >= 0) {
str = showdown.subParser('makehtml.spanGamut')(str, options, globals);
str = str.replace(/^([ \t]*)/g, '<p>');
str += '</p>';
grafsOut.push(str);
}
}
item = grafsOut.join('\n');
// Strip leading and trailing lines:
item = item.replace(/^\n+/g, '');
item = item.replace(/\n+$/g, '');
} else {
// Recursion for sub-lists:

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -87,14 +87,14 @@ showdown.subParser('makehtml.lists', function (text, options, globals) {
return '¨A' + wm2;
});
// SPECIAL CASE: an heading followed by a paragraph of text that is not separated by a double newline
// SPECIAL CASE: a heading followed by a paragraph of text that is not separated by a double newline
// or/nor indented. ex:
//
// - # foo
// bar is great
//
// While this does now follow the spec per se, not allowing for this might cause confusion since
// header blocks don't need double newlines after
// header blocks don't need double-newlines after
if (/^#+.+\n.+/.test(item)) {
item = item.replace(/^(#+.+)$/m, '$1\n');
}
@ -103,7 +103,47 @@ showdown.subParser('makehtml.lists', function (text, options, globals) {
// Has a double return (multi paragraph)
if (m1 || (item.search(/\n{2,}/) > -1)) {
item = showdown.subParser('makehtml.githubCodeBlocks')(item, options, globals);
item = showdown.subParser('makehtml.blockGamut')(item, options, globals);
item = showdown.subParser('makehtml.blockQuotes')(item, options, globals);
item = showdown.subParser('makehtml.headers')(item, options, globals);
item = showdown.subParser('makehtml.lists')(item, options, globals);
item = showdown.subParser('makehtml.codeBlocks')(item, options, globals);
item = showdown.subParser('makehtml.tables')(item, options, globals);
item = showdown.subParser('makehtml.hashHTMLBlocks')(item, options, globals);
//item = showdown.subParser('makehtml.paragraphs')(item, options, globals);
// TODO: This is a copy of the paragraph parser
// This is a provisory fix for issue #494
// For a permanente fix we need to rewrite the paragraph parser, passing the unhashify logic outside
// so that we can call the paragraph parser without accidently unashifying previously parsed blocks
// Strip leading and trailing lines:
item = item.replace(/^\n+/g, '');
item = item.replace(/\n+$/g, '');
var grafs = item.split(/\n{2,}/g),
grafsOut = [],
end = grafs.length; // Wrap <p> tags
for (var i = 0; i < end; i++) {
var str = grafs[i];
// if this is an HTML marker, copy it
if (str.search(/¨([KG])(\d+)\1/g) >= 0) {
grafsOut.push(str);
// test for presence of characters to prevent empty lines being parsed
// as paragraphs (resulting in undesired extra empty paragraphs)
} else if (str.search(/\S/) >= 0) {
str = showdown.subParser('makehtml.spanGamut')(str, options, globals);
str = str.replace(/^([ \t]*)/g, '<p>');
str += '</p>';
grafsOut.push(str);
}
}
item = grafsOut.join('\n');
// Strip leading and trailing lines:
item = item.replace(/^\n+/g, '');
item = item.replace(/\n+$/g, '');
} else {
// Recursion for sub-lists:

View File

@ -55,7 +55,7 @@ showdown.subParser('makeMarkdown.table', function (node, globals) {
for (ii = 0; ii < tableArray[i].length; ++ii) {
if (i === 1) {
if (tableArray[i][ii].slice(-1) === ':') {
tableArray[i][ii] = showdown.helper.padEnd(tableArray[i][ii].slice(-1), cellSpacesCount - 1, '-') + ':';
tableArray[i][ii] = showdown.helper.padEnd(tableArray[i][ii].slice(0, -1), cellSpacesCount - 1, '-') + ':';
} else {
tableArray[i][ii] = showdown.helper.padEnd(tableArray[i][ii], cellSpacesCount, '-');
}

View File

@ -264,14 +264,17 @@ This is a second.
</code></pre></li>
<li><p>Blue</p></li>
<li><p>Red</p>
<pre><code>* Green<pre><code>Try this code:
<pre><code>* Green
This is an embedded code block.
Try this code:
Then this:
This is an embedded code block.
More code!
</code></pre>* Blue
Then this:
More code!
* Blue
* Red
</code></pre></li>
</ul>
@ -365,4 +368,4 @@ This is a code block, fenced-style
<hr />
<hr />
<hr />
<hr />
<hr />

View File

@ -0,0 +1,10 @@
<pre><code>public static void main(String[] args) {
for (int i = 0; i &lt; 10 &amp;&amp; true; i++) {
System.out.println("Hello World");
}
// stuff here is affected as well &lt;&gt;&amp;&amp;%
}
</code></pre>

View File

@ -0,0 +1,11 @@
```
public static void main(String[] args) {
for (int i = 0; i < 10 && true; i++) {
System.out.println("Hello World");
}
// stuff here is affected as well <>&&%
}
```

View File

@ -0,0 +1,13 @@
<ol>
<li><p>Code block as part of list</p>
<pre><code>public static void main(String[] args) {
for (int i = 0; i &lt; 10 &amp;&amp; true; i++) {
System.out.println("Hello World");
}
// stuff here is affected as well &lt;&gt;&amp;&amp;%
}
</code></pre></li>
</ol>

View File

@ -0,0 +1,13 @@
1. Code block as part of list
```
public static void main(String[] args) {
for (int i = 0; i < 10 && true; i++) {
System.out.println("Hello World");
}
// stuff here is affected as well <>&&%
}
```