fix: keep non-breaking spaces in text
Since the `u` flag was added to the whitespace regex in TextConverter (7f03acf), `\s` also matches U+00A0, so ` ` and literal non-breaking spaces were turned into regular spaces. Leave U+00A0 out of the collapse. EmphasisConverter used trim(), which does not strip U+00A0, so a non-breaking space at the edge of <em>/<strong> would now end up inside the delimiters (`**Total: **`), where it stops them from flanking the text. Strip it there too; like before, it becomes a regular space outside the delimiters. Fixes #258
This commit is contained in:
1 parent
87f03af20c
commit
af172f8665
3 files changed
+18
-6
No files matched your search
@@ -378,6 +378,14 @@ EOT;
|
||||
$this->assertHtmlGivesMarkdown('<code><p>Some sample HTML</p></code>', '`<p>Some sample HTML</p>`');
|
||||
}
|
||||
|
||||
public function testNonBreakingSpaces(): void
|
||||
{
|
||||
$this->assertHtmlGivesMarkdown('<p>This is a test and test</p>', "This is a test and\u{00A0}test");
|
||||
$this->assertHtmlGivesMarkdown("<p>12,50\u{00A0}\u{00A0}€ \n total</p>", "12,50\u{00A0}\u{00A0}€ total");
|
||||
$this->assertHtmlGivesMarkdown('<p><strong>Total: </strong>12,50 €</p>', "**Total:** 12,50\u{00A0}€");
|
||||
$this->assertHtmlGivesMarkdown('<p>a<em> </em>b</p>', "a\u{00A0}b");
|
||||
}
|
||||
|
||||
public function testSetOption(): void
|
||||
{
|
||||
$markdown = new HtmlConverter();
|
||||
|
||||
Reference in new issue
Block a user