4
$\begingroup$

2021 (almost) update: Is it time to reconsider Language Sensitive Highlighting? Python has been established as a welcomed language and several java or javascript questions have been allowed and answered. We need computer scripts and programs to calculate orbits and trajectories, and to sort through databases like Jonathan McDowell's GCAT.

Are there any downsides?


                           

In this question (edit: and this question and increasingly many others) I have added a short python script as a code block (all lines indented by four spaces). In stackoverflow, adding the Tag python turns on the highlighting appropriate for python.

Is there a way to do that here - it looks so drab now!

update: per comments below, it looks like language sensitive highlighting for code blocks may not be activated here. If not, is there any interest in turning it on?

four spaces turns on code blocks

so those are available, it's just that

language-sensitive highlighing is not available, so it's just drab gray.

See here as a random example just for comparison.

$\endgroup$
8
  • 1
    $\begingroup$ Answered here: meta.stackexchange.com/questions/184108/… $\endgroup$ – Brian Tompsett - 汤莱恩 May 6 '16 at 11:36
  • $\begingroup$ @BrianTompsett-汤莱恩 I'm trying to turn on syntax highlighting in space.stackexchange - python was entered manually as a tag in the linked question (it's wasn't available at the time) but I don't see the highlighting yet. Is there something more in that link that I am missing? $\endgroup$ – uhoh May 11 '16 at 14:36
  • 1
    $\begingroup$ Yes, I edited the question to turn it on and it was not effective. I wonder if this feature is disabled in SX... $\endgroup$ – Brian Tompsett - 汤莱恩 May 11 '16 at 15:07
  • $\begingroup$ @BrianTompsett-汤莱恩 I wonder if i is easy to 'disable the disable' - and if there is a way to trigger the language sensitivity without inserting a python tag into the question. $\endgroup$ – uhoh Aug 15 '16 at 12:16
  • $\begingroup$ The Stack Exchange developers have been quite overburdened for some time now, and they are not very inclined to spend time on small changes to small Beta sites. One can't really blame them. Success is such a burden :). Considering the number of other feature-requests in the queue right now, it sort of behooves us to leave aside small changes for the time being. $\endgroup$ – kim holder Aug 18 '16 at 17:22
  • $\begingroup$ @kimholder Kim if you click on the example in the last line of my question you can see this is an existing feature, going way back to the beginnings of stackoverflow. It's turned on in some SE sites but not in others. Check the sentence labeled update above. $\endgroup$ – uhoh Aug 18 '16 at 22:06
  • 1
    $\begingroup$ Apologies for the delay, @called2voyage — it's not clear to me whether there's a community consensus on this. If you feel you've come to as much of a consensus as you can on this, please create a separate post linking to this one, and tag it [feature-request] and [status-review] ^_^ $\endgroup$ – JNat Jan 22 at 10:53
  • 1
    $\begingroup$ @JNat No worries! When I added the review tag, the were no answers in disagreement at that time, and the yes answer had been up with a positive score for several years. I may revisit this one later when I have more time to put up a new post. $\endgroup$ – called2voyage Jan 22 at 18:52
2
$\begingroup$

edit 2020: Since this answer was posted we've had several questions with languages other than Python by people other than me, so this 2016 answer should not be seen as anyone's opinion besides my own.

edit: I'm wondering, will the occasional python script here in SXSE actually break the bandwidth bank on the server side here? And compared to the page load delays associated with inserting MathJax equations which is done all over the place here, will it really have a significant impact? I don't think there is a significant down-side to turning it on here.

However, if code or script is used in an answer, but the name of the language is not tagged (e.g. python) in the question, I don't know if there is another way to activate the language sensitivity.


There is a question&answer cluster on the "main meta" about language-sensitive syntax highlighting. Essentially there are bandwidth costs on the server side, and load time costs for the rest of us, so it's not active by default on many/most sites.

I don't think there's a big need for it here in SX SE myself - we're only talking about color highlighting.

As long as I can do this here by indenting with four spaces - I'm okay

But other's may find language sensitive highlighting helpful.

$\endgroup$
-1
$\begingroup$

There's no problem with the code "looking drab" and having every page parsed by prettify.js (or whatever) on every computer viewing it just in case there's some code there seems overkill for something that is purely aesthetic.

MathJax is more widely used, and more functional, so is worth it.

But as long as long as we don't start using tag based syntax highlighting I only have a very mild objection -- much less so than adding uninformative images to questions to make them seem a little less boring.

There is a problem with having to tag a post with python to activate python-specific highlighting if it means tags will have to be created, as creating such tags tends to make people believe the subject of the tag is on topic.

Python has been established as a welcomed language

citation needed.

We don't need more questions asking how to translate a routine from python to Javascript, just because it's space related.

$\endgroup$
5
  • $\begingroup$ Precisely how many "questions (are) asking how to translate a routine from python to Javascript" right now? Should we purge all tags that might "(tend) to make people believe the subject of the tag is on topic"? There might be hundreds! $\endgroup$ – uhoh Dec 19 '20 at 12:57
  • $\begingroup$ more than zero @uhoh $\endgroup$ – user20636 Dec 19 '20 at 13:13
  • $\begingroup$ I think there zero and right now there's no evidence to the contrary. Is it possible to cite a few to demonstrate that this actually happens more than never or once per 10,000 questions? $\endgroup$ – uhoh Dec 19 '20 at 13:32
  • 2
    $\begingroup$ @JCRM Having the language-sensitive syntax highlighting does not require having SE tags for those languages $\endgroup$ – called2voyage Dec 19 '20 at 22:51
  • 1
    $\begingroup$ @called2voyage I was misled by statements such as "Behind the scenes, Stack Exchanges uses the tags on the question to determine the language you are using." and it's only if one digs deeper that you find "by specifying a language hint above the code block. Note that this is only supported when using the code fence (```) method" $\endgroup$ – user20636 Dec 20 '20 at 0:38

You must log in to answer this question.

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