Trying to understand parsing of overlapping code and link

I’m trying to understand the difference in parsing two different cases where the document could be parsed as either inline code or link - but it feels the choice is not consistent. The two cases are


These parse as:

<a href="%60"></a>`

i.e. in the first case, the inline-code interpretation overrules the link interpretation, while in the second case the link interpretation overrules the inline-code interpretation.

Is there a specific rule in the spec that explains why this happens?

In the second case [](`)` the first backtick occurs in the URL part of the link which gets parsed literally and hence, can’t start a markdown element. It simply gets %60.

In the first case, the dingus parser parses this code to [<code>]()</code>. That’s because the backtick occurs at a point where markdown elements can start. Hence, it starts an inline-code which takes everything up to the next backtick and ‘destroys’ the link.

@jo-so is correct - I had a typo in the original post: the two strings were parsing as

<a href="%60"></a>`


<a href="%60"></a>`

as I originally had - that would be extra weird. I’ve corrected the original post now.