0

The following is the screenshot of an answer I had posted on Stack Overflow.my answer

What is to be noticed here is that the question is tagged , , , , and . I executed the code in Visual Studio 2010 and posted it with comments (using ') for explanation, but at that time the comments were not recognized. Then I tried to comment them using a double slash (//) - that's shown in the image. But this is not the proper way of commenting in VB.NET - it'd be an error in Visual Studio. Note that languages that use // for comments (C#, Java, C++) are not tagged here.

Link to my answer: Creating a SQL Server database for the first time at run time

Proof that comments are recognized based on tags:

This comment will not be recognized

Vb code with C++ tag

The comment is recognized

Vb.net code with vb.net tag

1
  • 2
    The problem is not with one tag, it is because of the cobination of the Sql tag AND the VB tag which have both prettify hints. On a code block only one can exist and because prettify don't want to choose it fallsback to default. It can be easy solved by adding the language hint as I did on your question.
    – rene
    Commented Aug 2, 2014 at 19:08

1 Answer 1

6

You need to manually specify which language you want it to be highlighted as, for example using lang-vb. Currently the tags on that question conflict with each other and cause it to revert to default, which means Prettify will try to infer what language it is.

See What is syntax highlighting and how does it work?

7
  • but all tags in this particular question wont support commenting with double slash //
    – Suji
    Commented Aug 2, 2014 at 18:41
  • Adding <!-- language: lang-vb --> before the code block does indeed fix it.
    – rene
    Commented Aug 2, 2014 at 18:42
  • 2
    @Sujith The tags don't matter. They're ignored completely because they conflict with each other (sql vs vb).
    – animuson StaffMod
    Commented Aug 2, 2014 at 18:42
  • Fixed it in this revision: stackoverflow.com/revisions/25032383/2
    – rene
    Commented Aug 2, 2014 at 18:43
  • @ animuson : comments are recognized based on tags i will attach proof for this to my question soon
    – Suji
    Commented Aug 2, 2014 at 18:48
  • 2
    Yes, @Sujith, we know. animuson is saying, the tags are ignored in that question, specifically, because the tags that would trigger proper syntax highlighting (sql and vb) conflict with each other. Commented Aug 2, 2014 at 19:25
  • Thanks for the reviews, now i got the problem i will suggest a solution in next post, keep it in mind while doing modification. meta.stackoverflow.com/questions/267579/…
    – Suji
    Commented Aug 2, 2014 at 19:27

You must log in to answer this question.

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