Skip to content

Commit

Permalink
Don't add footnotes for bare URLs
Browse files Browse the repository at this point in the history
This was the desired behaviour, but it was checking for un-titled
links by comparing *after escaping*, so when there were special
characters it'd never match and it'd always get a footnote.
  • Loading branch information
samwilson authored Sep 23, 2023
1 parent 6c9c43b commit 6eebac0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/LinkRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 . '}';
}

Expand Down
2 changes: 1 addition & 1 deletion tests/data/links.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ Relative link: [label](./spaced%20example.html).

Inline URL with angle brackets: <https://example.org>

Bare inline URL: https://example.org
Bare inline URL: https://example.org/foo_bar
2 changes: 1 addition & 1 deletion tests/data/links.tex
Original file line number Diff line number Diff line change
Expand Up @@ -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}

0 comments on commit 6eebac0

Please sign in to comment.