mirror of
https://github.com/roundcube/roundcubemail.git
synced 2026-03-03 06:44:03 +01:00
This implements rendering mime-types with content-type 'text/markdown' and 'text/x-markdown' into HTML in the preview and show views (if not "dispositioned" as "attachment"), but not in the get view for attached files (the one opening attachments in an external window.)
46 lines
870 B
PHP
46 lines
870 B
PHP
<?php
|
|
|
|
namespace Roundcube\Tests\Framework;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
/**
|
|
* Test class to test rcube_markdown class
|
|
*/
|
|
class MarkdownTest extends TestCase
|
|
{
|
|
public function test_to_html()
|
|
{
|
|
// A test string that includes syntax from GitHub Flavoured Markdown.
|
|
$source = <<<'END'
|
|
# A headline
|
|
|
|
Hello there!
|
|
|
|
---------
|
|
|
|
* one
|
|
* two
|
|
* three
|
|
|
|
~not~
|
|
END;
|
|
|
|
$expected = <<<'END'
|
|
<h1>A headline</h1>
|
|
<p>Hello there!</p>
|
|
<hr />
|
|
<ul>
|
|
<li>one</li>
|
|
<li>two</li>
|
|
<li>three</li>
|
|
</ul>
|
|
<p><del>not</del></p>
|
|
|
|
END;
|
|
|
|
$markdown = \rcube_markdown::to_html($source);
|
|
$this->assertSame($expected, $markdown);
|
|
}
|
|
}
|