32

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.

0

1 Answer 1

25

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.

9
  • 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
    Commented May 18, 2012 at 8:32
  • 3
    Windows,->,->,Enter also solves it.
    – bobobobo
    Commented Oct 18, 2012 at 14:15
  • 5
    so why do comments support only a very limited form of markdown?
    – n611x007
    Commented Jan 25, 2017 at 15:39
  • 1
    @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
    Commented Jan 25, 2017 at 15:40
  • @bobobobo why are you using win? and you could just unplug the power.
    – n611x007
    Commented Jan 25, 2017 at 15:43
  • 3
    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
    Commented Jan 25, 2017 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
    Commented Jan 25, 2017 at 15:48
  • Windows ,->,->,Enter is kinder than Windows ,->,Enter
    – Brad Turek
    Commented Apr 13, 2018 at 16:12
  • 1
    I would like to mention it would be very nice to be able to do <kbd> in comments because right now I'm putting a comment to a newcomer that they can select text and press Ctrl + K to add the inline code formatting, and I think it would be a lot neater and clearer if it was shown as keys instead of being displayed the same as the code that will also be in the comment. Commented May 12, 2023 at 19:30

You must log in to answer this question.

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