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

AutolinkExtension parses emails twice #689

Closed
onigoetz opened this issue Jul 26, 2021 · 2 comments · Fixed by #691
Closed

AutolinkExtension parses emails twice #689

onigoetz opened this issue Jul 26, 2021 · 2 comments · Fixed by #691
Labels
bug Something isn't working right fixed Fix has been implemented

Comments

@onigoetz
Copy link
Contributor

Version(s) affected: 2.0.0

Description
Using CommonMarkCoreExtension and AutolinkExtension together with mail addresses results in nested links

How to reproduce

use League\CommonMark\MarkdownConverter;
use League\CommonMark\Environment\Environment;
use League\CommonMark\Extension\Autolink\AutolinkExtension;
use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension;

$environment = new Environment([]);
$environment->addExtension(new CommonMarkCoreExtension());
$environment->addExtension(new AutolinkExtension());

$converter = new MarkdownConverter($environment);

echo $converter->convertToHtml('[me@mydomain.com](mailto:me@mydomain.com)');

results in

<p>
  <a href="mailto:me@mydomain.com">
    <a href="mailto:me@mydomain.com">
      me@mydomain.com
    </a>
  </a>
</p>

But I would have expected (babelmark too) to get

<p>
  <a href="mailto:me@mydomain.com">
    me@mydomain.com
  </a>
</p>

P.S. Congrats and great work on V2 ! I'm integrating it in Daux and it's going well so far :)

@colinodell
Copy link
Member

Good find! It looks like this is essentially the same problem as #688, so a similar fix should work fine: #691 I'll have this merged and released sometime this week.

And thank you for the kind words!

@close-label close-label bot added the fixed Fix has been implemented label Jul 31, 2021
@colinodell
Copy link
Member

Fix has been released in 2.0.1! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working right fixed Fix has been implemented
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants