Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: correctly consume the child block, with example fenced code block #13

Merged
Merged
Changes from 2 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
31 changes: 31 additions & 0 deletions tests/FigureTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,4 +162,35 @@ public function testDifferentNumberOfSymbolsWithFigureCaption()
$this->assertSame($expect_1, $actual_1, 'Case with more upper is failed');
$this->assertSame($expect_2, $actual_2, 'Case with more lower is failed');
}

public function testFigureWithCodeBlockRetainsIndent()
{
$environment = new Environment();

$environment->addExtension(new CommonMarkCoreExtension())
->addExtension(new FigureExtension());

$converter = new MarkdownConverter($environment);

$expect = <<<EOL
<figure><pre><code>if (condition) {
doSomething();
dkarlovi marked this conversation as resolved.
Show resolved Hide resolved
}
</code></pre></figure>

EOL;

$actual_md = <<<EOL
^^^
```
if (condition) {
doSomething();
}
```
^^^
EOL;
$actual = $converter->convert($actual_md)->getContent();

$this->assertSame($expect, $actual);
}
}