3

This seems to be working here, but not on SO.

I was answering a question today and wanted to add a link to an inline code block. In markdown it looked like this:

`Timer`

Then I highlighted the word "Timer" without the quotes, pressed the link button, pasted my link, posted the answer and the link was broken, it showed up like this: [Timer][1].

That fails to render as a link, but does render as inline code. I'm not a language expert by any means, and I don't think the spec is explicit on what should happen in this case, but it seems like this should be a valid inline code span with a link in it.

In any case, if the link box is pressed, it seems like it should try to produce a valid link from the selection.

1
  • According to the CommonMark specs: Backtick code spans, autolinks, and raw HTML tags bind more tightly than the brackets in link text. Thus, for example, [foo`]` could not be a link text, since the second ] is part of a code span. So the behavior above is expected
    – nhahtdh
    Commented Aug 11, 2015 at 7:32

2 Answers 2

1

You need to wrap the backticks and all.

This is [`code`](http://www.example.com)

Will be rendered as

This is code

2
  • I got that, that's how I had originally fixed it, but I reverted it on SO to show that it is not working the other way. Of course... it is working the other way on meta, so now it's obvious there is a bug somewhere.
    – Nick Larsen Mod
    Commented Aug 10, 2015 at 23:46
  • 1
    ... I don't see a difference. If I select the text within the backticks on meta or on so, it doesn't produce a link, it just puts the links syntax inside a code block. And on both, if I select the whole thing (including backticks), it will produce a valid linked inline code block. I guess I don't understand the question.
    – user4639281
    Commented Aug 10, 2015 at 23:50
1

The correct markdown would be:

[`Timer`][1]

[1]: https://msdn.microsoft.com/en-us/library/system.timers.timer(v=vs.110).aspx

which renders as:

Timer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .