php-markdown icon indicating copy to clipboard operation
php-markdown copied to clipboard

Links with nested code don't work

Open webmozart opened this issue 8 years ago • 5 comments

It seems that links with nested code don't work:

Some text describing what [`SomeClass`] does...

[`SomeClass`]: http://..../api/SomeClass.html

This is transformed to the HTML:

[<code>SomeClass</code>]

I would expect the <code> to be wrapped inside an <a>.

For reference, GitHub's parser recognizes such links:

Some text describing what SomeClass does...

webmozart avatar Sep 04 '15 09:09 webmozart

Acknowledged. That's a bug in need of fixing. It might take a while to fix this though, as I think it'll require an overhaul of the span-level parser so that links are processed in the same pass as code spans.

Note that you can work around this by specifying explicitly a reference name, like this:

Some text describing what [`SomeClass`][SomeClass] does...

[SomeClass]: http://..../api/SomeClass.html

Just be sure not to include any ``` in the explicit reference name, or you'll encounter the same problem again.

michelf avatar Sep 04 '15 09:09 michelf

Awesome, thanks for the workaround! :)

webmozart avatar Sep 04 '15 09:09 webmozart

For reference, I just tried the workaround but it doesn't work for me. :(

webmozart avatar Sep 08 '15 08:09 webmozart

Seems to work fine on the dingus.

Which version of PHP Markdown are you using?

michelf avatar Sep 08 '15 10:09 michelf

Confirmed, it works with 1.5.0.

webmozart avatar Sep 08 '15 11:09 webmozart