Skip to content

Autolinks extension should ignore URIs inside link descriptions #97

@kukimik

Description

@kukimik

Calling:

commonmark-cli -x autolinks <<EOF
[https://www.website.com](https://www.website.com#something)

[nobody@example.com](mailto:nobody@example.com?subject=Some%20subject)

[A website similar to https://www.foo.com and https://www.bar.com](https://www.baz.com)
EOF

results in (note the nested <a> tags):

<p><a href="https://www.website.com#something"><a href="https://www.website.com">https://www.website.com</a></a></p>
<p><a href="mailto:nobody@example.com?subject=Some%20subject"><a href="mailto:nobody@example.com">nobody@example.com</a></a></p>
<p><a href="https://www.baz.com">A website similar to <a href="https://www.foo.com">https://www.foo.com</a> and <a href="https://www.bar.com">https://www.bar.com</a></a></p>

while I would expect

<p><a href="https://www.website.com#something">https://www.website.com</a></p>
<p><a href="mailto:nobody@example.com?subject=Some%20subject">nobody@example.com</a></p>
<p><a href="https://www.baz.com">A website similar to https://www.foo.com and https://www.bar.com</a></p>

One reason is that nested links are illegal in HTML5 and HTML4.

This bite me in srid/emanote#349.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions