Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 158 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

I typed an answer recently, and I used a code block where I had to use a double asterisk:


The text following the double asterisk was grayed out. I searched meta but couldn't find advice how to escape asterisks.

The original answer may be seen here: Maven directory structure: good place for SQL (DDL, ...) scripts

share|improve this question
up vote 7 down vote accepted

You don't have to escape it. Rather, you can use language hints for syntax highlighting to have the code block be highlighted XML instead of Java (this is inferred from the tag used in the question). Add this in front of your code block:

<!-- language: lang-or-tag-here -->

In this case, lang-xml did the job.

share|improve this answer
Thanks, I would never have found that post myself. – MaDa Oct 7 '11 at 12:28

While using a code block is the correct solution here, if you do need to escape something outside of a code block, use a backslash. For example, *this* is not in italics because I wrote \*this\*.

share|improve this answer
Thanks. But it does not work in the code block, does it? I've read backslash is treated differently there. – MaDa Oct 7 '11 at 13:37
Yes, inside code blocks backslashes have no special meaning, and they show as entered. Note that your problem here has nothing to do with escaping, but rather the choice of highlighting language. – hammar Oct 7 '11 at 13:40
@MaDa - In Java, /* is the start of a block comment, and this character sequence appears in your post. Therefore, everything after these characters are formatted as a comment. – Kevin Vermeer Oct 7 '11 at 15:22
@KevinVermeer Now it makes sense; I didn't know my snippet was interpreted as Java. – MaDa Oct 8 '11 at 0:04

You must log in to answer this question.

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