Skip to content

Commit

Permalink
Merge pull request #982 from hydephp/update-coloured-blockquotes-to-s…
Browse files Browse the repository at this point in the history
…upport-inner-markdown

Update coloured blockquotes to support inner Markdown
  • Loading branch information
caendesilva authored Feb 12, 2023
2 parents c430ff2 + 6031310 commit ad96cc6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Hyde\Markdown\Processing;

use Hyde\Markdown\Contracts\MarkdownShortcodeContract;
use Hyde\Markdown\Models\Markdown;

/**
* @see \Hyde\Framework\Testing\Feature\ColoredBlockquoteShortcodesTest
Expand All @@ -30,7 +31,7 @@ protected static function expand(string $input): string
return sprintf(
'<blockquote class="%s">%s</blockquote>',
static::getClassNameFromSignature(static::signature()),
trim(substr($input, strlen(static::signature())), ' ')
trim(Markdown::render(trim(substr($input, strlen(static::signature())), ' ')))
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ColoredBlockquoteShortcodesTest extends TestCase
{
public function test_resolve_method()
{
$this->assertEquals('<blockquote class="color">foo</blockquote>',
$this->assertEquals('<blockquote class="color"><p>foo</p></blockquote>',
ColoredBlockquotes::resolve('>color foo'));
}

Expand All @@ -26,4 +26,11 @@ public function test_get_method()
$this->assertContainsOnlyInstancesOf(ColoredBlockquotes::class,
ColoredBlockquotes::get());
}

public function test_can_use_markdown_within_blockquote()
{
$this->assertEquals('<blockquote class="color"><p>foo <strong>bar</strong></p></blockquote>',
ColoredBlockquotes::resolve('>color foo **bar**')
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function test_discovered_shortcodes_are_used_to_process_input()
{
$processor = new ShortcodeProcessor('>info foo');

$this->assertEquals('<blockquote class="info">foo</blockquote>',
$this->assertEquals('<blockquote class="info"><p>foo</p></blockquote>',
$processor->run());
}

Expand All @@ -38,7 +38,7 @@ public function test_string_without_shortcode_is_not_modified()

public function test_process_static_shorthand()
{
$this->assertEquals('<blockquote class="info">foo</blockquote>',
$this->assertEquals('<blockquote class="info"><p>foo</p></blockquote>',
ShortcodeProcessor::preprocess('>info foo'));
}

Expand Down

0 comments on commit ad96cc6

Please sign in to comment.