When I manually specify the language of a code block as VB.NET like this:

<!-- language: vbnet -->

    theNodeList.Cast(Of XmlNode)()
theNodeList.Cast(Of XmlNode)()

the code is not highlighted. But this variation works:

<!-- language: lang-vbnet -->

    theNodeList.Cast(Of XmlNode)()
theNodeList.Cast(Of XmlNode)()

I get the same results for both versions when I replace vbnet with vb.net:

<!-- language: vb.net -->

    theNodeList.Cast(Of XmlNode)()
theNodeList.Cast(Of XmlNode)()
<!-- language: lang-vb.net -->

    theNodeList.Cast(Of XmlNode)()
theNodeList.Cast(Of XmlNode)()

In the first version, the language is specified through the tag. In the second version, it's specified through the syntax highlighting parser name. The problem is that the tag isn't automatically setting the correct parser for (unlike most other language tags). This old comment indicates that a diamond moderator has the power to fix this. Or perhaps the parser is correctly set for the tag, but there's a bug in Stack Overflow with tags with periods in their names.

The tags on a question shouldn't affect whether this problem appears, since the comment should override all tags. That makes this question different from VB.NET code highlighting problem resurging, where there were multiple tags on a question, and a code block with no comment was being assigned the wrong default language.

  • 2
    The funny thing is that big PHP frameworks (like Symfony or cakePHP) links to PHP and vbnet, the language tag, does not even link to vbnet xD May 14, 2013 at 5:39
  • 2
    According to the source code of prettify, we only have vb and vbs, no vbnet May 14, 2013 at 8:18
  • @JohannesKuhn Ah. I tried vbnet because that's Vim's name for its VB.NET syntax highlighter, and then I saw it seem to work. But it looks like even lang-vbfoo highlights as Visual Basic - the suffix is ignored. Still, using the vb highlighter for vb.net is better than no highlighting at all. May 14, 2013 at 16:14
  • FWIW, highlighting is correctly configured for vb.net. If there are multiple language tags, you'll need to set the highlight explicitly, which is described here: meta.stackexchange.com/questions/63800/…
    – Shog9
    Aug 16, 2013 at 15:03
  • @Shog9 I don’t see how highlighting is correctly configured. If I create a new question with the vb.net tag and paste some code like Call MyFun into it, the code is not highlighted at all. The code should be highlighted using the vb highlighter, which is the closest approximation for vb.net we have, and better than nothing. You can see that the code looks better when you manually add <!-- language: lang-vb --> – but you shouldn’t have to manually add that; the vb.net tag should do that for you. Aug 16, 2013 at 15:12
  • Can you give me an example of it not working, @Rory? Looks right here.
    – Shog9
    Aug 16, 2013 at 15:15
  • @Shog9 It looks like I was confusing the unknown-language highlighting with the lang-vb highlighting. In the question above, with the (nonexistent) lang-vb.net parser, Cast and Of XmlNode are colored blue; I assumed that was how they were supposed to be highlighted. But now I see that with the lang-vb parser, they are not highlighted; instead, keywords like Call are highlighted in dark blue. So vb.net does have highlighting, it just doesn’t highlight things I thought it would. Aug 16, 2013 at 15:28

1 Answer 1


The reason for this behavior is simple: if it starts with lang- then it uses that language.

Otherwise it uses the assigned highlighting for THAT tag.


  • vbnet tries to use the highlighting of the tag (which does not exist)
  • lang-vbnet uses the vbnet highlighting. For the list of aviable langs see here
  • vb.net uses the highlighting of which was assigned to vbnet. (I hope. If not, request it here on meta as .)

Not a bug IMHO.

  • Also note that the tag based selection does not work if there are incompatible tags like sql and vb.net. May 13, 2013 at 21:04
  • 2
    The vb.net tag is missing its assignation to lang-vbnet. <!-- language: vb.net --> doesn't work. That's what I meant by "I get the same results for both versions when I replace vbnet with vb.net." So there is a problem here. Maybe "bug" is the wrong term for this type of problem, but the vb.net tag is missing its link to the lang-vbnet parser. May 13, 2013 at 21:09
  • Ok, this is a different thing. Maybe feature-request would be better than bug? May 13, 2013 at 21:10
  • Okay, I changed the tag to feature-request. May 13, 2013 at 21:14

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