What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 134 Stack Exchange communities.

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

<exclude>
     <pattern>src/main/**</pattern>
</exclude>

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

2 Answers 2

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
1  
@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 .