23

I would like to use the <kbd> tag in a comment to refer to a keyboard shortcut. Is there a reason why this doesn't seem to be possible? I've tried it at the webapps stackexchange.

18

No, you cannot.

Comments only support a very limited form of markdown syntax, affectionately called "mini-markdown". And they definitely don't support HTML tags, which are required for <kbd> to work.

It's relatively rare to need to display keyboard shortcuts in comments. If you need this much formatting, you should probably be posting an answer instead.

As a workaround hack, use inline code formatting to make keyboard shortcuts stand out. For example:

Press `Alt`+`F4` to solve your problem.

produces:

Press Alt+F4 to solve your problem.

  • 1
    Ok sure, I'll do that. I was just wondering if there were any possibilities. I wanted to refer to a keyboard shortcut that someone posted and it was definitely not an answer. – Marnix May 18 '12 at 8:32
  • 3
    Windows,->,->,Enter also solves it. – bobobobo Oct 18 '12 at 14:15
  • 2
    so why do comments support only a very limited form of markdown? – n611x007 Jan 25 '17 at 15:39
  • @n611 "It's relatively rare to need to display keyboard shortcuts in comments. If you need this much formatting, you should probably be posting an answer instead." – Cody Gray Jan 25 '17 at 15:40
  • @bobobobo why are you using win? and you could just unplug the power. – n611x007 Jan 25 '17 at 15:43
  • 1
    I was asking about sup and sub and got redirected here. could not pose that as an answer as I was trying to suggest an edit to the poster. I could have done the edit but it would have been too intrusive as it would have replaced author's notations without author's consent. so the "better of having an answer" argument doesn't hold for my case thus it is invalid there. also, I've expected some harder reason. – n611x007 Jan 25 '17 at 15:46
  • I've been using the website for over 6 years, I've posted thousands or more comments, and I don't think I've ever once wanted to use HTML tags in a comment. I think "the feature doesn't exist because it isn't important and thus isn't worth the time to implement it" is reason enough. Also, if more formatting was allowed in comments, it would be subject to abuse, which is a problem since comments can't be edited by others. Why would you need superscript and subscript text in a comment? And if you actually think that presentation would improve the answer, then you should suggest the edit. @n611 – Cody Gray Jan 25 '17 at 15:48
  • Windows ,->,->,Enter is kinder than Windows ,->,Enter – Brad Turek Apr 13 '18 at 16:12

You must log in to answer this question.

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