mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 17:58:41 +00:00
update markdown
This commit is contained in:
parent
37db31e85f
commit
b69c9b708c
|
|
@ -14,6 +14,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace phpOMS\tests\Utils\Parser\Markdown;
|
||||
|
||||
include_once __DIR__ . '/../../../Autoloader.php';
|
||||
|
||||
use phpOMS\System\File\Local\Directory;
|
||||
use phpOMS\Utils\Parser\Markdown\Markdown;
|
||||
|
||||
|
|
@ -42,4 +44,12 @@ final class MarkdownTest extends \PHPUnit\Framework\TestCase
|
|||
|
||||
self::assertTrue(true);
|
||||
}
|
||||
|
||||
public function testSafeMode() : void
|
||||
{
|
||||
$parser = new Markdown();
|
||||
$parser->setSafeMode(true);
|
||||
|
||||
self::assertTrue(\file_get_contents(__DIR__ . '/manualdata/xss_bad_url.html') === ($parsed = $parser->text(\file_get_contents(__DIR__ . '/manualdata/xss_bad_url.md'))), $parsed);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
3
tests/Utils/Parser/Markdown/data/abbreviation.html
Normal file
3
tests/Utils/Parser/Markdown/data/abbreviation.html
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<p>The <abbr title="Hyper Text Markup Language">HTML</abbr> specification
|
||||
is maintained by the <abbr title="World Wide Web Consortium">W3C</abbr>.
|
||||
The abbreviation <abbr title="Markup Language">ML</abbr> is contained in the abbreviation <abbr title="Hyper Text Markup Language">HTML</abbr>.</p>
|
||||
7
tests/Utils/Parser/Markdown/data/abbreviation.md
Normal file
7
tests/Utils/Parser/Markdown/data/abbreviation.md
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
The HTML specification
|
||||
is maintained by the W3C.
|
||||
The abbreviation ML is contained in the abbreviation HTML.
|
||||
|
||||
*[HTML]: Hyper Text Markup Language
|
||||
*[W3C]: World Wide Web Consortium
|
||||
*[ML]: Markup Language
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
<h1>h1</h1>
|
||||
<h2>h2</h2>
|
||||
<h3>h3</h3>
|
||||
<h4>h4</h4>
|
||||
<h5>h5</h5>
|
||||
<h6>h6</h6>
|
||||
<h1 id="h1">h1</h1>
|
||||
<h2 id="h2">h2</h2>
|
||||
<h3 id="h3">h3</h3>
|
||||
<h4 id="h4">h4</h4>
|
||||
<h5 id="h5">h5</h5>
|
||||
<h6 id="h6">h6</h6>
|
||||
<p>####### not a heading</p>
|
||||
<h1>closed h1</h1>
|
||||
<p>#</p>
|
||||
<h1 id="closed-h1">closed h1</h1>
|
||||
<h1 id=""></h1>
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
<blockquote>
|
||||
<h2>header</h2>
|
||||
<h2 id="header">header</h2>
|
||||
<p>paragraph</p>
|
||||
<ul>
|
||||
<li>li</li>
|
||||
|
|
|
|||
18
tests/Utils/Parser/Markdown/data/compound_footnote.html
Normal file
18
tests/Utils/Parser/Markdown/data/compound_footnote.html
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<p>footnote <sup id="fnref1:1"><a href="#fn:1" class="footnote-ref">1</a></sup> and another one <sup id="fnref1:2"><a href="#fn:2" class="footnote-ref">2</a></sup></p>
|
||||
<div class="footnotes">
|
||||
<hr />
|
||||
<ol>
|
||||
<li id="fn:1">
|
||||
<p>line 1
|
||||
line 2</p>
|
||||
<blockquote>
|
||||
<p>quote</p>
|
||||
</blockquote>
|
||||
<p>another paragraph <a href="#fnref1:1" rev="footnote" class="footnote-backref">↩</a></p>
|
||||
</li>
|
||||
<li id="fn:2">
|
||||
<p>paragraph</p>
|
||||
<p>another paragraph <a href="#fnref1:2" rev="footnote" class="footnote-backref">↩</a></p>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
13
tests/Utils/Parser/Markdown/data/compound_footnote.md
Normal file
13
tests/Utils/Parser/Markdown/data/compound_footnote.md
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
footnote [^1] and another one [^2]
|
||||
|
||||
[^1]: line 1
|
||||
line 2
|
||||
|
||||
> quote
|
||||
|
||||
another paragraph
|
||||
|
||||
[^2]:
|
||||
paragraph
|
||||
|
||||
another paragraph
|
||||
|
|
@ -1,12 +1,12 @@
|
|||
<ul>
|
||||
<li>li
|
||||
<ul>
|
||||
<li>li
|
||||
<ul>
|
||||
<li>li<ul>
|
||||
<li>li<ul>
|
||||
<li>li</li>
|
||||
<li>li</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>li</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>li</li>
|
||||
</ul>
|
||||
23
tests/Utils/Parser/Markdown/data/definition_list.html
Normal file
23
tests/Utils/Parser/Markdown/data/definition_list.html
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<dl>
|
||||
<dt>Term 1</dt>
|
||||
<dd>one</dd>
|
||||
<dd>two
|
||||
extra line</dd>
|
||||
<dt>Term 2</dt>
|
||||
<dd>
|
||||
<p>lazy
|
||||
line</p>
|
||||
</dd>
|
||||
<dd>
|
||||
<p>multiple</p>
|
||||
<p>paragraphs</p>
|
||||
</dd>
|
||||
<dd>
|
||||
<p>nested</p>
|
||||
<pre><code>code block</code></pre>
|
||||
<blockquote>
|
||||
<p>quote
|
||||
block</p>
|
||||
</blockquote>
|
||||
</dd>
|
||||
</dl>
|
||||
20
tests/Utils/Parser/Markdown/data/definition_list.md
Normal file
20
tests/Utils/Parser/Markdown/data/definition_list.md
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
Term 1
|
||||
: one
|
||||
: two
|
||||
extra line
|
||||
|
||||
Term 2
|
||||
|
||||
: lazy
|
||||
line
|
||||
|
||||
: multiple
|
||||
|
||||
paragraphs
|
||||
|
||||
: nested
|
||||
|
||||
code block
|
||||
|
||||
> quote
|
||||
> block
|
||||
20
tests/Utils/Parser/Markdown/data/footnote.html
Normal file
20
tests/Utils/Parser/Markdown/data/footnote.html
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<p>first <sup id="fnref1:1"><a href="#fn:1" class="footnote-ref">1</a></sup> second <sup id="fnref1:2"><a href="#fn:2" class="footnote-ref">2</a></sup>.</p>
|
||||
<p>first <sup id="fnref1:a"><a href="#fn:a" class="footnote-ref">3</a></sup> second <sup id="fnref1:b"><a href="#fn:b" class="footnote-ref">4</a></sup>.</p>
|
||||
<p>second time <sup id="fnref2:1"><a href="#fn:1" class="footnote-ref">1</a></sup></p>
|
||||
<div class="footnotes">
|
||||
<hr />
|
||||
<ol>
|
||||
<li id="fn:1">
|
||||
<p>one <a href="#fnref1:1" rev="footnote" class="footnote-backref">↩</a> <a href="#fnref2:1" rev="footnote" class="footnote-backref">↩</a></p>
|
||||
</li>
|
||||
<li id="fn:2">
|
||||
<p>two <a href="#fnref1:2" rev="footnote" class="footnote-backref">↩</a></p>
|
||||
</li>
|
||||
<li id="fn:a">
|
||||
<p>one <a href="#fnref1:a" rev="footnote" class="footnote-backref">↩</a></p>
|
||||
</li>
|
||||
<li id="fn:b">
|
||||
<p>two <a href="#fnref1:b" rev="footnote" class="footnote-backref">↩</a></p>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
11
tests/Utils/Parser/Markdown/data/footnote.md
Normal file
11
tests/Utils/Parser/Markdown/data/footnote.md
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
first [^1] second [^2].
|
||||
|
||||
[^1]: one
|
||||
[^2]: two
|
||||
|
||||
first [^a] second [^b].
|
||||
|
||||
[^a]: one
|
||||
[^b]: two
|
||||
|
||||
second time [^1]
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
<blockquote>
|
||||
<p>quote
|
||||
the rest of it</p>
|
||||
</blockquote>
|
||||
<blockquote>
|
||||
<p>another paragraph
|
||||
the rest of it</p>
|
||||
</blockquote>
|
||||
25
tests/Utils/Parser/Markdown/data/markdown_inside_markup.html
Normal file
25
tests/Utils/Parser/Markdown/data/markdown_inside_markup.html
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
<div class="example">
|
||||
<p><em>markdown</em></p>
|
||||
<p>This is another paragraph. It contains <em>inline markup</em>.</p>
|
||||
<div>
|
||||
_no markdown_
|
||||
</div>
|
||||
</div>
|
||||
<hr />
|
||||
<div>
|
||||
<p><em>markdown</em></p>
|
||||
<div>
|
||||
<p><em>markdown</em></p>
|
||||
</div>
|
||||
</div>
|
||||
<hr />
|
||||
<div>
|
||||
_no markdown_
|
||||
<div>
|
||||
<p><em>markdown</em></p>
|
||||
</div>
|
||||
</div>
|
||||
<hr />
|
||||
<div markdown="0">
|
||||
_no markdown_
|
||||
</div>
|
||||
32
tests/Utils/Parser/Markdown/data/markdown_inside_markup.md
Normal file
32
tests/Utils/Parser/Markdown/data/markdown_inside_markup.md
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<div class="example" markdown="1">
|
||||
_markdown_
|
||||
|
||||
This is another paragraph. It contains <em>inline markup</em>.
|
||||
<div>
|
||||
_no markdown_
|
||||
</div>
|
||||
</div>
|
||||
|
||||
---
|
||||
|
||||
<div markdown="1">
|
||||
_markdown_
|
||||
<div markdown="1">
|
||||
_markdown_
|
||||
</div>
|
||||
</div>
|
||||
|
||||
---
|
||||
|
||||
<div>
|
||||
_no markdown_
|
||||
<div markdown="1">
|
||||
_markdown_
|
||||
</div>
|
||||
</div>
|
||||
|
||||
---
|
||||
|
||||
<div markdown="0">
|
||||
_no markdown_
|
||||
</div>
|
||||
|
|
@ -8,5 +8,7 @@
|
|||
<li>
|
||||
<p>li</p>
|
||||
</li>
|
||||
<li>li</li>
|
||||
<li>
|
||||
<p>li</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
<h1>h1</h1>
|
||||
<h2>h2</h2>
|
||||
<h2>single character</h2>
|
||||
<h1 id="h1">h1</h1>
|
||||
<h2 id="h2">h2</h2>
|
||||
<h2 id="single-character">single character</h2>
|
||||
<p>not a header</p>
|
||||
<hr />
|
||||
|
|
@ -2,7 +2,9 @@
|
|||
<li>
|
||||
<p>li</p>
|
||||
</li>
|
||||
<li>li</li>
|
||||
<li>
|
||||
<p>li</p>
|
||||
</li>
|
||||
</ul>
|
||||
<hr />
|
||||
<ul>
|
||||
|
|
|
|||
6
tests/Utils/Parser/Markdown/data/special_attributes.html
Normal file
6
tests/Utils/Parser/Markdown/data/special_attributes.html
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<h1 id="header1">Header 1</h1>
|
||||
<h2 id="header2">Header 2</h2>
|
||||
<h2 class="main" id="the-site">The Site</h2>
|
||||
<h2 id="the-site" class="main shine">The Site</h2>
|
||||
<p><a href="http://parsedown.org" id="link" class="primary upper-case">link</a></p>
|
||||
<p><img src="/md.png" alt="logo" id="logo" class="big" /></p>
|
||||
12
tests/Utils/Parser/Markdown/data/special_attributes.md
Normal file
12
tests/Utils/Parser/Markdown/data/special_attributes.md
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
Header 1 {#header1}
|
||||
========
|
||||
|
||||
## Header 2 ## {#header2}
|
||||
|
||||
## The Site ## {.main}
|
||||
|
||||
## The Site ## {.main .shine #the-site}
|
||||
|
||||
[link](http://parsedown.org) {.primary #link .upper-case}
|
||||
|
||||
 {#logo .big}
|
||||
|
|
@ -5,6 +5,10 @@
|
|||
<p>mixed markers:</p>
|
||||
<ul>
|
||||
<li>li</li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li>li</li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li>li</li>
|
||||
</ul>
|
||||
0
tests/Utils/Parser/Markdown/data/xss_bad_url.html → tests/Utils/Parser/Markdown/manualdata/xss_bad_url.html
Executable file → Normal file
0
tests/Utils/Parser/Markdown/data/xss_bad_url.html → tests/Utils/Parser/Markdown/manualdata/xss_bad_url.html
Executable file → Normal file
0
tests/Utils/Parser/Markdown/data/xss_bad_url.md → tests/Utils/Parser/Markdown/manualdata/xss_bad_url.md
Executable file → Normal file
0
tests/Utils/Parser/Markdown/data/xss_bad_url.md → tests/Utils/Parser/Markdown/manualdata/xss_bad_url.md
Executable file → Normal file
Loading…
Reference in New Issue
Block a user