Skip to content

Text in links should be ignored. #5

@waylan

Description

@waylan

If text is already in a link, it should be ignored. For example. if a document were to contain...

[@waylan](https://example.com/waylan)

The link would be parsed (as it should), and then this extension would parse the link label (@waylan) and nest a second link inside the first one, resulting in the following:

<a href="https://example.com/waylan">
    <a class="gh-link gh-mention" 'href="https://github.com/waylan" title="GitHub User: @waylan">@waylan</a>
</a>

In addition to the wierdness of the nested links, notice that the first link is not a GitHub mention, but something else. Of course as a workaround, you can escape the mention, like this:

[\@waylan](https://example.com/waylan)

But it should be smart enough to not insert a link inside another link. The problem is that Python-Markdown doesn't really provide a way to check that (inline patterns have no access to their parent). And it gets potentially more complicated when there is multiple levels of nesting. Consider this:

[**@waylan**](https://example.com/waylan)

The direct parent is not a link (<a> tag), but an ancestor is. Therefore, the behavior should be the same as if the direct parent was a link.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions