TL;DR: Minecraft has the ability to syntax highlight NBT, and StackOverflow has the ability to highlight JSON, so why can't we?
On StackOverflow, there is the ability to add syntax highlighting to your code blocks like so:
```java
void doSomething() {
System.out.println("Hello, World!");
}
```
This has only be added to StackOverflow right now, but I would like to ask whether we can add it to Arqade.
At first glance, you may think that adding code syntax highlighting is not really needed, since questions that include code are probably going to get closed as off-topic for the game development reason.
But there are two file formats that frequently appear on Arqade and are not closed as off-topic: NBT and JSON.
In many posts where I help users with NBT, I sometimes expand NBT to show the syntax tree more clearly, like so:
Wrong way:
display:{ Name: [ { text:"This is a test" } ] }
Right way:
display:{ Name:'[{"text":"This is a test"}]' }
When you type NBT in your posts, syntax is very important! One mistyped character and you run the risk of having invalid NBT data.
It would be much easier to notice and display corrected or malformed NBT if it was syntax-highlighted. In fact, Minecraft already highlights NBT for us:
My feature request is that for any NBT or JSON detected in commands, automatically syntax-highlight it. For example:
This would be helpful in situations like this, where JSON and NBT are combined. Without syntax highlighting, it isn't immediately obvious that the inners of the Name
tag are a string.
But with syntax highlighting:
Now it is clearly obvious that the JSON text inside is actually a string, clearing up the fog on why it looks weird.
I think that whenever a question has minecraft-commands on it, we should automatically detect and syntax highlight NBT.
This will probably a challenge because NBT is not an official language and will need to be manually programmed in, but I think that we'll be able to do it if we put our mind into it!