erusev / parsedown-extra

Markdown Extra Extension for Parsedown
MIT License
821 stars 124 forks source link

Various Tests with Broken Result #90

Open taufik-nurrohman opened 8 years ago

taufik-nurrohman commented 8 years ago

Tested with Parsedown 1.6.0 and Parsedown Extra 0.7.0.

require 'Parsedown.php';
require 'ParsedownExtra.php';
$input = ' ... ';
$parser = new ParsedownExtra;
echo $parser->text($input);

Test 1

Input

Paragraph here.

<button>foo</button> <span>Text 1</span>

Paragraph here.

Output

<p>Paragraph here.</p>
<button>foo</button>

Expected

<p>Paragraph here.</p>
<button>foo</button> <span>Text 1</span>
<p>Paragraph here.</p>

or…

<p>Paragraph here.</p>
<p><button>foo</button> <span>Text 1</span></p>
<p>Paragraph here.</p>

Test 2

Input

Paragraph here.

<div>
  <input type="checkbox"> <span>Check 1</span>
</div>

Paragraph here.

Output

<p>Paragraph here.</p>
<div>
  <input type="checkbox"><span>Check 1</span>
</div>
<p>Paragraph here.</p>

Expected

Keep white-space in between.

<p>Paragraph here.</p>
<div>
  <input type="checkbox"> <span>Check 1</span>
</div>
<p>Paragraph here.</p>

Test 3

Input

Paragraph here.

<img src="/favicon.ico">

<input type="text">

<button>Button</button>

<select>
  <option>Option 1</option>
  <option>Option 2</option>
</select>

<textarea>Text goes here...</textarea>

Paragraph here.

---

Paragraph here.

<img src="/favicon.ico"> aaa

<input type="text"> aaa

<button>Button</button> aaa

<select>
  <option>Option 1</option>
  <option>Option 2</option>
</select> aaa

<textarea>Text goes here...</textarea> aaa

Paragraph here.

Output

<p>Paragraph here.</p>
<img src="/favicon.ico">
<input type="text">
<button>Button</button>
<select><option>Option 1</option><option>Option 2</option></select>
<textarea>Text goes here...</textarea>
<p>Paragraph here.</p>
<hr>
<p>Paragraph here.</p>
<p><img src="/favicon.ico"> aaa</p>
<p><input type="text"> aaa</p>
<button>Button</button>

Expected

<p>Paragraph here.</p>
<p><img src="/favicon.ico"></p>
<p><input type="text"></p>
<p><button>Button</button></p>
<p><select><option>Option 1</option><option>Option 2</option></select></p>
<p><textarea>Text goes here...</textarea></p>
<p>Paragraph here.</p>
<hr>
<p>Paragraph here.</p>
<p><img src="/favicon.ico"> aaa</p>
<p><input type="text"> aaa</p>
<p><button>Button</button> aaa</p>
<p><select><option>Option 1</option><option>Option 2</option></select> aaa</p>
<p><textarea>Text goes here...</textarea> aaa</p>
<p>Paragraph here.</p>

Test 4

Input

1. list item 1

2. list item 2

   1. list item 2.1

   2. list item 2.2

3. list item 3

4. list item 5

Output

<ol>
<li>
<p>list item 1</p>
</li>
<li>
<p>list item 2</p>
<ol>
<li>
<p>list item 2.1</p>
</li>
<li>list item 2.2</li>
</ol>
</li>
<li>
<p>list item 3</p>
</li>
<li>list item 5</li>
</ol>

Expected

<ol>
<li>
<p>list item 1</p>
</li>
<li>
<p>list item 2</p>
<ol>
<li>
<p>list item 2.1</p>
</li>
<li>
<p>list item 2.2</p>
</li>
</ol>
</li>
<li>
<p>list item 3</p>
</li>
<li>
<p>list item 5</p>
</li>
</ol>
taufik-nurrohman commented 8 years ago

Input

<div markdown="1">
Lorem ipsum dolor sit amet. Some test code here `<html>`
</div>

<div markdown="1">
Lorem ipsum dolor sit amet. Some test code here `<span>`
</div>

<div markdown="1">
Lorem ipsum dolor sit amet. Some test code here `->`
</div>

Output

<div>
<p>Lorem ipsum dolor sit amet. Some test code here ``</p>
</div>

<div>
<p>Lorem ipsum dolor sit amet. Some test code here <code>&lt;span&gt;</code>
</span></p>
</div>

<div>
<p>Lorem ipsum dolor sit amet. Some test code here <code>-&amp;gt;</code></p>
</div>

Expected

<div>
<p>Lorem ipsum dolor sit amet. Some test code here <code>&lt;html&gt;</code></p>
</div>

<div>
<p>Lorem ipsum dolor sit amet. Some test code here <code>&lt;span&gt;</code></p>
</div>

<div>
<p>Lorem ipsum dolor sit amet. Some test code here <code>-&gt;</code></p>
</div>
taufik-nurrohman commented 7 years ago

Input

Example of broken footnote [^1]

[^1]: Lorem ipsum [link text][abc]

[abc]: http://example.com

Output

<p>Example of broken footnote <sup id="fnref1:1"><a href="#fn:1" class="footnote-ref">1</a></sup></p>
<div class="footnotes">
<hr>
<ol>
<li id="fn:1">
<p>Lorem ipsum [link text][abc]&#160;<a href="#fnref1:1" rev="footnote" class="footnote-backref">&#8617;</a></p>
</li>
</ol>
</div>

Expected

<p>Example of broken footnote <sup id="fnref1:1"><a href="#fn:1" class="footnote-ref">1</a></sup></p>
<div class="footnotes">
<hr>
<ol>
<li id="fn:1">
<p>Lorem ipsum <a href="http://example.com">link text</a>&#160;<a href="#fnref1:1" rev="footnote" class="footnote-backref">&#8617;</a></p>
</li>
</ol>
</div>