How can you put italics or bold inside code in a comment?

For example, to produce normal italic in a comment I've tried

  • `normal _italic_`

  • `normal `_`italic`_

  • <code>normal _italic_</code>

  • <code>normal <i>italic</i></code>

But none of these work. I've also tried replacing the underscores with asterisks:

  • `normal *italic*`

  • `normal `*`italic`*

  • <code>normal *italic*</code>

  • <code>normal <i>italic</i></code>

Note that the last three items in each list work as expected when applied outside of comments (i.e. in questions and answers). I've also read through the comment formatting section of the site, but I still can't figure it out. And I know this type of thing is possible because I've seen it in the Formatting Sandbox.


You're almost there, you just have to reverse the order of the formatting:

  • **`bold`** produces bold
  • *`italic`* produces italic

As you can see, this works in posts as well.

| improve this answer | |
  • That is definitely helpful. But is there a way to make a combined piece of code with both normal text and italics, as in the example I mentioned in my question? It seems that if you try to put *`italic`* next to `normal`, the formatting breaks. – wxyz Aug 20 '19 at 6:48
  • normal italic works (with a space in between). Zero-width Unicode spaces seem to be stripped, so that doesn't help. – Glorfindel Aug 20 '19 at 6:49
  • Could you not use <I> italic </I> – Dan K Aug 22 '19 at 11:56
  • That works too (in posts, not in comments), but is longer to type. – Glorfindel Aug 22 '19 at 11:57

You must log in to answer this question.

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