Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions components/Markdown/Tests/MarkdownConsumerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ public static function provider_test_conversion() {
'markdown' => '**Bold** and *Italic*',
'expected' => '<!-- wp:paragraph --><p><b>Bold</b> and <em>Italic</em></p><!-- /wp:paragraph -->',
),
'Strikethrough text' => array(
'markdown' => 'Keep ~~removed~~ text and continue.',
'expected' => '<!-- wp:paragraph --><p>Keep <del>removed</del> text and continue.</p><!-- /wp:paragraph -->',
),
'A blockquote' => array(
'markdown' => '> A simple blockquote',
'expected' => '<!-- wp:quote --><blockquote class="wp-block-quote"><!-- wp:paragraph --><p>A simple blockquote</p><!-- /wp:paragraph --></blockquote><!-- /wp:quote -->',
Expand Down
8 changes: 8 additions & 0 deletions components/Markdown/class-markdownconsumer.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use League\CommonMark\Extension\CommonMark\Node\Block as ExtensionBlock;
use League\CommonMark\Extension\CommonMark\Node\Inline as ExtensionInline;
use League\CommonMark\Extension\GithubFlavoredMarkdownExtension;
use League\CommonMark\Extension\Strikethrough\Strikethrough;
use League\CommonMark\Extension\Table\Table;
use League\CommonMark\Extension\Table\TableCell;
use League\CommonMark\Extension\Table\TableRow;
Expand Down Expand Up @@ -234,6 +235,10 @@ private function convert_markdown_to_blocks() {
$this->append_content( '<em>' );
break;

case Strikethrough::class:
$this->append_content( '<del>' );
break;

case ExtensionInline\HtmlInline::class:
$this->append_content( htmlspecialchars( $node->getLiteral() ) );
break;
Expand Down Expand Up @@ -323,6 +328,9 @@ private function convert_markdown_to_blocks() {
case ExtensionInline\Emphasis::class:
$this->append_content( '</em>' );
break;
case Strikethrough::class:
$this->append_content( '</del>' );
break;
case ExtensionInline\Link::class:
$this->append_content( '</a>' );
break;
Expand Down
Loading