The vast majority of code shown under the tensorflow, tensorboard, and keras tags is Python; the most commonly-used API for these libraries. It would be helpful if we could add automatic Python syntax highlighting for these two tags.
Currently no syntax highlighting is set by default, so we get un-highlighted code unless the author happens to include a python tag with their post, or adds <!-- language-all: python -->
to their code manually.
Edit 1: I finally found a post on the Tensorflow tag that uses both C++ and Python code. I tried out both formatting tags on the C++ code blocks and they look the same. I am sure there are some fringe cases in which they might look different, but I think overall defaulting to Python syntax highlighting on these tags is safe.
I tried to show some example code blocks, but it looks like syntax highlighting isn't enabled in meta.
Edit 2: Note that many questions with the tensorflow, tensorboard, or keras tags use Python code, but really have nothing to do with the Python language or syntax, and thus appropriately are not given the python tag. In these common cases, I would say that the coder should not include the python tag just because their post includes Python code, and for that matter a solution that relies on the poster to know to do something discussed in a meta thread once upon a time is not a solution at all.
Edit 3: I found a couple of questions on the tensorflow tag that show shell commands for installing libraries, running scripts, etc. Generally these look the same with Python syntax highlighting or bash syntax highlighting, so I think this is another safe case. I would really love it if somebody with the authority to set default syntax highlighting could just pick one (I highly recommend Python), and set it for the tensorflow, tensorboard, and keras tags. Otherwise I can continue my crusade of manually adding <!-- language-all: python -->
to every other question I find that did not include the python tag.
P.S. relying on including the python
tag, in my opinion, just clutters this tag with a bunch of questions that are in no way related to Python programming, and leaves us exactly where we are now, with tons of un-highlighted code gracing our tensorflow
tag. See edit 2 above.
<!-- language-all: python -->
to your question, the answer is because nobody ever does. The proposed change would clear up the editing queue a bit and make questions more readable by default.<!-- language-all: xxx -->
to a post it's almost always because they used the "add snippet" feature, which tags the code as JavaScript and tries to present it as a runnable program (which it is not). I've had to remove the<!-- snippet -->
tag and fix the language on over a dozen C# Unity questions in the last couple of weeks alone.pyspark
andsparkr
tags: meta.stackoverflow.com/questions/362624/…