Skip to content

emphasis mixed in text and link description breaks link parsing #96

@twouters

Description

@twouters

The emphasis in the following example takes precedence over link detection while I think it should be the other way around?

text containing _emphasis start breaks when followed by [link text with emphasis_ end](https://example.com)

GFM results in (as expected): text containing _emphasis start breaks when followed by link text with emphasis_ end

simple test to show unexpected behavior:

        it("should properly parse mixed emphasis and links", function() {
            var parsed6 = inlineParse("text containing _emphasis start breaks when followed by [link text with emphasis_ end](https://example.com)");
            validateParse(parsed6, [{
                content: "text containing ",
                type: "text"
            },{
                content: [{
                    "content": "emphasis start breaks when followed by ",
                    "type": "text"
                },{
                    "content": "[link text with emphasis",
                    "type": "text"
                }],
                type: "em"
            },{
                "content": " end",
                "type": "text"
            },{
                "content": "]",
                "type": "text"
            },{
                "content": "(",
                "type": "text"
            },{
                content: [{
                    type: "text",
                    content: "https://example.com"
                }],
                type: "link",
                target: "https://example.com",
                title: undefined
            },{
                "content": ")",
                "type": "text"
            }]);
        });

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