thephpleague / html-to-markdown

Convert HTML to Markdown with PHP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Link with mailto

arvodia opened this issue · comments

problem converting a link with mailto which contains the same text with href :

convert('<a href="mailto:aze@aze.aze">aze@aze.aze</a>')

show

<aze@aze.aze>

However

convert('<a href="mailto:aze@aze.aze">aze@aze.aze </a>')

show

"[aze@aze.aze ](mailto:aze@aze.aze)"

I just add a space at the end of text

thank you for explaining to me, is it a problem with my configuration or is it a bug ?

This is the expected behavior. Think about what would happen when the Markdown is converted back into HTML.

Markdown like <aze@aze.aze > (with a trailing space) is not recognized as a valid email autolink per the CommonMark specification: https://spec.commonmark.org/0.30/#email-autolink See example 607 in particular.

The only Markdown that would produce the original HTML you provided (with that space) is Markdown that uses the normal link syntax of [aze@aze.aze ](mailto:aze@aze.aze).