108

Since the syntax highlighter is now highlight.js it would be great to finally get some syntax highlighting for Julia code on Stack Overflow and other sites that might need this tag. Julia is one of the supported languages in highlight.js.

With over 9k questions already, this will benefit a lot of people.


Answers to some comments to add some more motivation.

If you write a feature request please outline why this would benefit the entire community.

This question does not make sense to me; the entire community is not benefiting from Python syntax highlighting either, the Python community is. Likewise, the Julia community will benefit from Julia syntax highlighting. The Julia tag already has more activity than some other language tags that are already included in the highlight.js file loaded by the site:

Stack Overflow Insights > Trends graph

so I think it would definitely be worthwhile to include Julia.

Or else why would the benefits for a few users outweigh the costs for all other users?

I am not sure what (noticeable) cost there would be for adding another language, library size(?). Presumably a "one-time" cost since the browser would cache it. Anyway, here is the library built with the current supported languages with and without Julia:

Building highlight.js. (Current languages)
-----
highlight.min.js    : 136002 bytes
highlight.min.js.gz : 46091 bytes
-----


Building highlight.js. (Current languages + Julia)
-----
highlight.min.js    : 139505 bytes
highlight.min.js.gz : 47477 bytes
-----

So an approximately 1.5 KB increase. If you compare this to other content on the site (400 KB for the top question with the Julia tag) this would be less than a 0.4% increase.

2
3

Syntax highlighting happens on the client side currently. This means that if we add too many different languages, the size of the distributable gets very large and can make the site slower to load. While any one language might be a good addition, we get enough language requests that if we added them all, we'd have a long list and a big problem.

I've talked with Ben Kelly, one of our Stacks team developers and, while he really hopes to eventually support nearly all languages that highlight.js supports, it'll require some big changes to how we process syntax highlighting and we don't know when we'll be able to get this work scheduled.

In the nearer term, we're actively planning how we can expand support for really popular, newer languages that we're not currently offering syntax highlighting for.

For these reasons, I'm marking this post and we'll update the answer should anything change in the future.

4
  • 16
    "we get enough language requests that if we added them all, we'd have a long list and a big problem." Do you though? Looking at syntax-highlighting, this is the top language request — ever. The only other currently outstanding language request with more than 15 votes here is Fortran (32 votes, 11k SO questions).
    – mbauman
    Aug 12 '21 at 20:24
  • 8
    It's also worth noting that the client-side performance was discussed in now-deleted comments — including more comments by the highlights.js maintainer. archive.is/4CBRZ
    – mbauman
    Aug 16 '21 at 20:38
  • 6
    "While any one language might be a good addition, we get enough language requests that if we added them all, we'd have a long list and a big problem." But you don't have to add every language that gets requested. You can look at the popularity of the language based on the StackOverflow activity and make a decision. Here, there is a language that is significantly more active than many others that already have highlighting. If there is a strong need to keep the size of the highlight file constant, you could remove support for one of the languages that are now very inacticve. Sep 23 '21 at 7:46
  • 3
    What criteria do you use to decide which languages get added? It seems that by any reasonable metric, Julia should be added!
    – becko
    Dec 6 '21 at 14:52

You must log in to answer this question.

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