1
0
mirror of https://github.com/erusev/parsedown.git synced 2023-08-10 21:13:06 +03:00

No markup can be achieved by removing the respective parsing Components

This commit is contained in:
Aidan Woods 2019-01-26 21:48:05 +00:00
parent f0da746c7b
commit cbe7b25b21
No known key found for this signature in database
GPG Key ID: 9A6A8EFAA512BBB9

View File

@ -2,7 +2,12 @@
namespace Erusev\Parsedown\Tests; namespace Erusev\Parsedown\Tests;
use Erusev\Parsedown\Components\Blocks\Comment;
use Erusev\Parsedown\Components\Blocks\Markup as BlockMarkup;
use Erusev\Parsedown\Components\Inlines\Markup as InlineMarkup;
use Erusev\Parsedown\Configurables\BlockTypes;
use Erusev\Parsedown\Configurables\Breaks; use Erusev\Parsedown\Configurables\Breaks;
use Erusev\Parsedown\Configurables\InlineTypes;
use Erusev\Parsedown\Configurables\SafeMode; use Erusev\Parsedown\Configurables\SafeMode;
use Erusev\Parsedown\Configurables\StrictMode; use Erusev\Parsedown\Configurables\StrictMode;
use Erusev\Parsedown\Parsedown; use Erusev\Parsedown\Parsedown;
@ -89,52 +94,55 @@ class ParsedownTest extends TestCase
return $data; return $data;
} }
// public function test_no_markup() public function test_no_markup()
// { {
// $markdownWithHtml = <<<MARKDOWN_WITH_MARKUP $markdownWithHtml = <<<MARKDOWN_WITH_MARKUP
// <div>_content_</div> <div>_content_</div>
// sparse: sparse:
// <div> <div>
// <div class="inner"> <div class="inner">
// _content_ _content_
// </div> </div>
// </div> </div>
// paragraph paragraph
// <style type="text/css"> <style type="text/css">
// p { p {
// color: red; color: red;
// } }
// </style> </style>
// comment comment
// <!-- html comment --> <!-- html comment -->
// MARKDOWN_WITH_MARKUP; MARKDOWN_WITH_MARKUP;
// $expectedHtml = <<<EXPECTED_HTML $expectedHtml = <<<EXPECTED_HTML
// <p>&lt;div&gt;<em>content</em>&lt;/div&gt;</p> <p>&lt;div&gt;<em>content</em>&lt;/div&gt;</p>
// <p>sparse:</p> <p>sparse:</p>
// <p>&lt;div&gt; <p>&lt;div&gt;
// &lt;div class="inner"&gt; &lt;div class="inner"&gt;
// <em>content</em> <em>content</em>
// &lt;/div&gt; &lt;/div&gt;
// &lt;/div&gt;</p> &lt;/div&gt;</p>
// <p>paragraph</p> <p>paragraph</p>
// <p>&lt;style type="text/css"&gt; <p>&lt;style type="text/css"&gt;
// p { p {
// color: red; color: red;
// } }
// &lt;/style&gt;</p> &lt;/style&gt;</p>
// <p>comment</p> <p>comment</p>
// <p>&lt;!-- html comment --&gt;</p> <p>&lt;!-- html comment --&gt;</p>
// EXPECTED_HTML; EXPECTED_HTML;
// $parsedownWithNoMarkup = new TestParsedown(); $parsedownWithNoMarkup = new Parsedown(new State([
// $parsedownWithNoMarkup->setMarkupEscaped(true); BlockTypes::initial()->removing([BlockMarkup::class, Comment::class]),
// $this->assertEquals($expectedHtml, $parsedownWithNoMarkup->text($markdownWithHtml)); InlineTypes::initial()->removing([InlineMarkup::class]),
// } ]));
$this->assertEquals($expectedHtml, $parsedownWithNoMarkup->text($markdownWithHtml));
}
} }