Skip to content

Commit 9223ccc

Browse files
committed
Temporary replace tildes to avoid it being parsed as NBSP
1 parent 3a300ac commit 9223ccc

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/Renderers/SpanNodeRenderer.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,19 @@ public function __construct(
4242
$this->symfonyVersion = $symfonyVersion;
4343
}
4444

45+
public function render(): string
46+
{
47+
// Work around "~" being parsed as non-breaking space by rst-parser,
48+
// while this is not part of the specification.
49+
$spanValue = $this->span->getValue();
50+
$spanValue = str_replace('~', '__TILDE__', $spanValue);
51+
$this->span->setValue($spanValue);
52+
53+
$rendered = parent::render();
54+
55+
return str_replace('__TILDE__', '~', $rendered);
56+
}
57+
4558
/** @inheritDoc */
4659
public function link(?string $url, string $title, array $attributes = []): string
4760
{

0 commit comments

Comments
 (0)