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

Preserve spaces that are emphasized #146

Merged
merged 2 commits into from Jan 7, 2018
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Converter/EmphasisConverter.php
Expand Up @@ -32,7 +32,7 @@ public function convert(ElementInterface $element)
$value = $element->getValue();

if (!trim($value)) {
return '';
return $value;
}

if ($tag === 'i' || $tag === 'em') {
Expand Down
3 changes: 3 additions & 0 deletions tests/HtmlConverterTest.php
Expand Up @@ -77,6 +77,9 @@ public function test_spans()
$this->html_gives_markdown('<b>Bold</b><i>Italic</i>', '**Bold**_Italic_');
$this->html_gives_markdown('<em>This is <strong>a test</strong></em>', '_This is **a test**_');
$this->html_gives_markdown('<em>This is </em><strong>a </strong>test', '_This is_ **a** test');
$this->html_gives_markdown('Emphasis with no<em> </em>text<strong> preserves</strong> spaces.', 'Emphasis with no text **preserves** spaces.');
$this->html_gives_markdown("Emphasis discards<em> \n</em>line breaks", "Emphasis discards line breaks");
$this->html_gives_markdown("Emphasis preserves<em><br/></em>HTML breaks", "Emphasis preserves \nHTML breaks");
}

public function test_nesting()
Expand Down