Been wondering about this for a while now, the tag seems to have an XML-language-hint.

Here is an example question which has both C# and XAML code, as one can see the C# is also in XML highlighting (espcially visible on generics like List<DataColumn>). It would probably be better if it behaved like the tag (which has a default hint).

  • 1
    But surely MVVM can apply to other languages than C# - or am I missing something?
    – ChrisF Mod
    Commented Feb 23, 2012 at 15:04
  • @ChrisF: That is why i am saying there should be no association at all.
    – brunnerh
    Commented Feb 23, 2012 at 15:05
  • 1
    Ah - I am missing something then.
    – ChrisF Mod
    Commented Feb 23, 2012 at 15:07
  • Isn't just the xml highlighted? So basically the xaml tag formats xml code.
    – gideon
    Commented Feb 23, 2012 at 15:11
  • @gideon: There is no XAML tag, that's the point, if there was i wouldn't be surprised.
    – brunnerh
    Commented Feb 23, 2012 at 15:15
  • oh jeez right, perusing SO for the millionth time after work does do things to your eyes I think! Agreed @H.B. your post makes sense.
    – gideon
    Commented Feb 23, 2012 at 15:17
  • As usual in these cases, I have to first ask if the change would break any existing syntax highlighting, and if so, how extensive the damage would be.
    – mmyers
    Commented Feb 23, 2012 at 16:01
  • @mmyers: Well, the XAML highlighting might suffer as currectly the c#+mvvm combination gets C# and XAML highlighted, if that change would be made the XAML would be highlighted as c# (which does not seem any worse than in many cases C# getting highlighted as XML).
    – brunnerh
    Commented Feb 23, 2012 at 16:05

1 Answer 1


Eh, I'm not sure about this.

As mentioned in the comments, by changing to lang-default, will end up being the only tag with a specific language hint, causing every code block (including the XAML) to be highlighted as C#. That's no good.

With lang-xml, a specific language hint, a question with both tags (and thus both language hints) will fall back to lang-default for highlighting. This allows each code block to be highlighted as appropriately as prettify thinks it can.

Personally, I don't think we should leave the question as is, with just the tag alone. In fact, I went ahead and added the and tags to it instead. After all, the language used in the question is C#, while MVVM is merely a pattern. It was probably given the lang-xml hint based on how MVVM is most prevalent in WPF/Silverlight application development, which uses XAML for views.

You must log in to answer this question.

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