Use ->toHtml over ->text

This commit is contained in:
Aidan Woods 2020-01-19 15:26:48 +00:00
parent a2ea704a43
commit a72455c78a
No known key found for this signature in database
GPG Key ID: 9A6A8EFAA512BBB9
5 changed files with 10 additions and 10 deletions

View File

@ -35,13 +35,13 @@ final class Parsedown
} }
/** /**
* @param string $text * @param string $markdown
* @return string * @return string
*/ */
public function text($text) public function toHtml($markdown)
{ {
list($StateRenderables, $State) = self::lines( list($StateRenderables, $State) = self::lines(
Lines::fromTextLines($text, 0), Lines::fromTextLines($markdown, 0),
$this->State $this->State
); );

View File

@ -50,7 +50,7 @@ class CommonMarkTestStrict extends TestCase
*/ */
public function testExample($_, $__, $markdown, $expectedHtml) public function testExample($_, $__, $markdown, $expectedHtml)
{ {
$actualHtml = $this->Parsedown->text($markdown); $actualHtml = $this->Parsedown->toHtml($markdown);
$this->assertEquals($expectedHtml, $actualHtml); $this->assertEquals($expectedHtml, $actualHtml);
} }

View File

@ -59,7 +59,7 @@ class CommonMarkTestWeak extends CommonMarkTestStrict
{ {
$expectedHtml = $this->cleanupHtml($expectedHtml); $expectedHtml = $this->cleanupHtml($expectedHtml);
$actualHtml = $this->Parsedown->text($markdown); $actualHtml = $this->Parsedown->toHtml($markdown);
$actualHtml = $this->cleanupHtml($actualHtml); $actualHtml = $this->cleanupHtml($actualHtml);
$this->assertEquals($expectedHtml, $actualHtml); $this->assertEquals($expectedHtml, $actualHtml);

View File

@ -61,7 +61,7 @@ class ParsedownTest extends TestCase
new Breaks(\substr($test, 0, 14) === 'breaks_enabled'), new Breaks(\substr($test, 0, 14) === 'breaks_enabled'),
])); ]));
$actualMarkup = $Parsedown->text($markdown); $actualMarkup = $Parsedown->toHtml($markdown);
$this->assertEquals($expectedMarkup, $actualMarkup); $this->assertEquals($expectedMarkup, $actualMarkup);
} }
@ -154,6 +154,6 @@ EXPECTED_HTML;
InlineTypes::initial()->removing([InlineMarkup::class]), InlineTypes::initial()->removing([InlineMarkup::class]),
])); ]));
$this->assertEquals($expectedHtml, $parsedownWithNoMarkup->text($markdownWithHtml)); $this->assertEquals($expectedHtml, $parsedownWithNoMarkup->toHtml($markdownWithHtml));
} }
} }

View File

@ -30,7 +30,7 @@ final class RecursionLimiterTest extends TestCase
. '<p>foo</p>' . '<p>foo</p>'
. \str_repeat("\n</blockquote>", 3) . \str_repeat("\n</blockquote>", 3)
), ),
$Parsedown->text($borderline) $Parsedown->toHtml($borderline)
); );
$this->assertSame( $this->assertSame(
@ -39,7 +39,7 @@ final class RecursionLimiterTest extends TestCase
. '<p>&gt; foo</p>' . '<p>&gt; foo</p>'
. \str_repeat("\n</blockquote>", 3) . \str_repeat("\n</blockquote>", 3)
), ),
$Parsedown->text($exceeded) $Parsedown->toHtml($exceeded)
); );
$this->assertSame( $this->assertSame(
@ -48,7 +48,7 @@ final class RecursionLimiterTest extends TestCase
. '<p>fo*o*</p>' . '<p>fo*o*</p>'
. \str_repeat("\n</blockquote>", 3) . \str_repeat("\n</blockquote>", 3)
), ),
$Parsedown->text($exceededByInline) $Parsedown->toHtml($exceededByInline)
); );
} }
} }