diff --git a/src/LinkRenderer.php b/src/LinkRenderer.php index adb54a7..11d4915 100644 --- a/src/LinkRenderer.php +++ b/src/LinkRenderer.php @@ -42,8 +42,8 @@ public function render(Node $node, ChildNodeRendererInterface $childRenderer) return $out; } - // Autolink extension makes the label and the URL the same. - if ($out === $url) { + // Autolink extension makes the label and the unescaped URL the same. + if ($out === $node->getUrl()) { return '\\url{' . $url . '}'; } diff --git a/tests/data/links.md b/tests/data/links.md index 8811715..183ea6d 100644 --- a/tests/data/links.md +++ b/tests/data/links.md @@ -4,4 +4,4 @@ Relative link: [label](./spaced%20example.html). Inline URL with angle brackets: -Bare inline URL: https://example.org +Bare inline URL: https://example.org/foo_bar diff --git a/tests/data/links.tex b/tests/data/links.tex index 54a25cb..a5f8fb2 100644 --- a/tests/data/links.tex +++ b/tests/data/links.tex @@ -4,5 +4,5 @@ Inline URL with angle brackets: \url{https://example.org} -Bare inline URL: \url{https://example.org} +Bare inline URL: \url{https://example.org/foo\_bar}