fix some tests

This commit is contained in:
Estevão Soares dos Santos 2022-11-15 05:00:09 +00:00
parent 9dab0826c6
commit 2d593d91f3
12 changed files with 20 additions and 22 deletions

View File

@ -29,6 +29,8 @@ showdown.subParser('makehtml.encodeCode', function (text, options, globals) {
// Do the angle bracket song and dance: // Do the angle bracket song and dance:
.replace(/</g, '&lt;') .replace(/</g, '&lt;')
.replace(/>/g, '&gt;') .replace(/>/g, '&gt;')
// encode "
.replace(/"/g, '&quot;')
// Now, escape characters that are magic in Markdown: // Now, escape characters that are magic in Markdown:
.replace(/([*_{}\[\]\\=~-])/g, showdown.helper.escapeCharactersCallback); .replace(/([*_{}\[\]\\=~-])/g, showdown.helper.escapeCharactersCallback);

View File

@ -1,3 +1,3 @@
<p>this is some text</p> <p>this is some text</p>
<p><code>php function thisThing() { echo "some weird formatted code!"; } </code></p> <p><code>php function thisThing() { echo &quot;some weird formatted code!&quot;; } </code></p>
<p>some other text</p> <p>some other text</p>

View File

@ -75,7 +75,7 @@ ___triple underscores___
<p>Which gives you a link like this:</p> <p>Which gives you a link like this:</p>
<p>This is <a href="http://example.com/" title="Optional Title Here">an example</a> reference-style link.</p> <p>This is <a href="http://example.com/" title="Optional Title Here">an example</a> reference-style link.</p>
<p>Elsewhere in the document, usually at the bottom of the file, you define your link label on a line by itself:</p> <p>Elsewhere in the document, usually at the bottom of the file, you define your link label on a line by itself:</p>
<pre><code>[id]: http://example.com/ "Optional Title Here" <pre><code>[id]: http://example.com/ &quot;Optional Title Here&quot;
</code></pre> </code></pre>
<p>Links can get pretty fancy, so if you want the long form version, visit the <p>Links can get pretty fancy, so if you want the long form version, visit the
official <a href="http://daringfireball.net/projects/markdown/">Markdown</a> docs.</p> official <a href="http://daringfireball.net/projects/markdown/">Markdown</a> docs.</p>
@ -84,7 +84,7 @@ ___triple underscores___
<p><img src="http://www.addictedtoibiza.com/wp-content/uploads/2012/12/example.png" alt="Alt text" /></p> <p><img src="http://www.addictedtoibiza.com/wp-content/uploads/2012/12/example.png" alt="Alt text" /></p>
<pre><code>![Alt text](http://www.addictedtoibiza.com/wp-content/uploads/2012/12/example.png) <pre><code>![Alt text](http://www.addictedtoibiza.com/wp-content/uploads/2012/12/example.png)
![Alt text](http://www.addictedtoibiza.com/wp-content/uploads/2012/12/example.png "Optional title") ![Alt text](http://www.addictedtoibiza.com/wp-content/uploads/2012/12/example.png &quot;Optional title&quot;)
</code></pre> </code></pre>
<hr /> <hr />
<h1 id="blockelements">Block Elements</h1> <h1 id="blockelements">Block Elements</h1>
@ -157,7 +157,7 @@ This is a second.
<li>This is the second list item.</li> <li>This is the second list item.</li>
</ol> </ol>
<p>Here's some example code:</p> <p>Here's some example code:</p>
<pre><code>return shell_exec("echo $input | $markdown_script"); <pre><code>return shell_exec(&quot;echo $input | $markdown_script&quot;);
</code></pre> </code></pre>
</blockquote> </blockquote>
<pre><code>&gt; ## This is a header. <pre><code>&gt; ## This is a header.
@ -167,7 +167,7 @@ This is a second.
&gt; &gt;
&gt; Here's some example code: &gt; Here's some example code:
&gt; &gt;
&gt; return shell_exec("echo $input | $markdown_script"); &gt; return shell_exec(&quot;echo $input | $markdown_script&quot;);
</code></pre> </code></pre>
<h2 id="lists">Lists</h2> <h2 id="lists">Lists</h2>
<p>Markdown supports ordered (numbered) and unordered (bulleted) lists. List markers typically start at the left margin, but may be indented by up to three spaces. List markers must be followed by one or more spaces or a tab.</p> <p>Markdown supports ordered (numbered) and unordered (bulleted) lists. List markers typically start at the left margin, but may be indented by up to three spaces. List markers must be followed by one or more spaces or a tab.</p>
@ -331,7 +331,7 @@ Pipe | $1 | eleven
<p>You can also highlight snippets of text (Markdown uses the excellent <a href="http://pygments.org/">Pygments</a> library) to allow you to use code highlighting Here's an example of some Python code:</p> <p>You can also highlight snippets of text (Markdown uses the excellent <a href="http://pygments.org/">Pygments</a> library) to allow you to use code highlighting Here's an example of some Python code:</p>
<pre><code>#!python <pre><code>#!python
# #
def wiki_rocks(text): formatter = lambda t: "funky"+t return formatter(text) def wiki_rocks(text): formatter = lambda t: &quot;funky&quot;+t return formatter(text)
</code></pre> </code></pre>
<p>To do this, do not indent the block. Start the block with <code>```</code> three ticks. Then, provide the comment with the type of syntax you are using. There is a <a href="http://pygments.org/docs/lexers/">the vast library of Pygment lexers</a>. Markdown accepts the 'short name' or the 'mimetype' of anything in there.</p> <p>To do this, do not indent the block. Start the block with <code>```</code> three ticks. Then, provide the comment with the type of syntax you are using. There is a <a href="http://pygments.org/docs/lexers/">the vast library of Pygment lexers</a>. Markdown accepts the 'short name' or the 'mimetype' of anything in there.</p>
<p>You can also use a fence style for code.</p> <p>You can also use a fence style for code.</p>

View File

@ -2,7 +2,7 @@
foo foo
```javascript ```javascript
var s = "JavaScript syntax highlighting"; var s = &quot;JavaScript syntax highlighting&quot;;
alert(s); alert(s);
``` ```
@ -11,12 +11,12 @@ bar
<p>this is a long paragraph</p> <p>this is a long paragraph</p>
<p>this is another long paragraph</p> <p>this is another long paragraph</p>
<pre lang="no-highlight"><code>```javascript <pre lang="no-highlight"><code>```javascript
var s = "JavaScript syntax highlighting"; var s = &quot;JavaScript syntax highlighting&quot;;
alert(s); alert(s);
``` ```
```python ```python
s = "Python syntax highlighting" s = &quot;Python syntax highlighting&quot;
print s print s
``` ```
</code></pre> </code></pre>

View File

@ -1,11 +1,11 @@
<pre lang="no-highlight"><code> <pre lang="no-highlight"><code>
```javascript ```javascript
var s = "JavaScript syntax highlighting"; var s = &quot;JavaScript syntax highlighting&quot;;
alert(s); alert(s);
``` ```
```python ```python
s = "Python syntax highlighting" s = &quot;Python syntax highlighting&quot;
print s print s
``` ```

View File

@ -2,7 +2,7 @@
for (int i = 0; i &lt; 10 &amp;&amp; true; i++) { for (int i = 0; i &lt; 10 &amp;&amp; true; i++) {
System.out.println("Hello World"); System.out.println(&quot;Hello World&quot;);
} }
// stuff here is affected as well &lt;&gt;&amp;&amp;% // stuff here is affected as well &lt;&gt;&amp;&amp;%

View File

@ -4,7 +4,7 @@
for (int i = 0; i &lt; 10 &amp;&amp; true; i++) { for (int i = 0; i &lt; 10 &amp;&amp; true; i++) {
System.out.println("Hello World"); System.out.println(&quot;Hello World&quot;);
} }
// stuff here is affected as well &lt;&gt;&amp;&amp;% // stuff here is affected as well &lt;&gt;&amp;&amp;%

View File

@ -1,8 +1,8 @@
<pre><code class="json language-json">{ <pre><code class="json language-json">{
"custom": true &quot;custom&quot;: true
} }
</code></pre> </code></pre>
<pre><code class="json language-json">{ <pre><code class="json language-json">{
"custom": false &quot;custom&quot;: false
} }
</code></pre> </code></pre>

View File

@ -5,6 +5,6 @@
<li>This is the second list item.</li> <li>This is the second list item.</li>
</ol> </ol>
<p>Here's some example code:</p> <p>Here's some example code:</p>
<pre><code>return shell_exec("echo $input | $markdown_script"); <pre><code>return shell_exec(&quot;echo $input | $markdown_script&quot;);
</code></pre> </code></pre>
</blockquote> </blockquote>

View File

@ -1,6 +1,6 @@
<ul> <ul>
<li><p>list item 1</p> <li><p>list item 1</p>
<pre><code class="html language-html">&lt;a href="www.google.com"&gt;google&lt;/a&gt; <pre><code class="html language-html">&lt;a href=&quot;www.google.com&quot;&gt;google&lt;/a&gt;
&lt;div&gt; &lt;div&gt;
&lt;div&gt;some div&lt;/div&gt; &lt;div&gt;some div&lt;/div&gt;
&lt;/div&gt; &lt;/div&gt;

View File

@ -1,5 +1,5 @@
<p><code>some **code** yeah</code></p> <p><code>some **code** yeah</code></p>
<p>some <code>inline **code** block</code></p> <p>some <code>inline **code** block</code></p>
<p><code>some inline **code**</code> block</p> <p><code>some inline **code**</code> block</p>
<p>yo dawg <code start="true">some &lt;code start="false"&gt;code&lt;/code&gt; inception</code></p> <p>yo dawg <code start="true">some &lt;code start=&quot;false&quot;&gt;code&lt;/code&gt; inception</code></p>
<div>some **div** yeah</div> <div>some **div** yeah</div>

View File

@ -29,10 +29,6 @@ describe('makeHtml() commonmark testsuite', function () {
//case 'Raw HTML_619': // breaks prettifier so the test fails //case 'Raw HTML_619': // breaks prettifier so the test fails
continue; continue;
case 'Setext headings_91': //it's failing because the testcase converts " to &quot; even though it's not supposed to
testsuite[section][i].expected = testsuite[section][i].expected.replace(/&quot;/g, '"')
break;
case 'Fenced code blocks_142': // we use different classes to mark languages in fenced code blocks case 'Fenced code blocks_142': // we use different classes to mark languages in fenced code blocks
case 'Fenced code blocks_143': // we use different classes to mark languages in fenced code blocks case 'Fenced code blocks_143': // we use different classes to mark languages in fenced code blocks
testsuite[section][i].expected = testsuite[section][i].expected.replace('language-ruby', 'ruby language-ruby'); testsuite[section][i].expected = testsuite[section][i].expected.replace('language-ruby', 'ruby language-ruby');