3

On this question: Can LastAccessTime be set to an old timestamp using PowerShell? I have a code block in the question and in the answer. Both code blocks are defined by having their lines start with 4 spaces. Neither have syntax highlighting hints. In the question, the syntax highlighting is a bit better because the comments are coloured correctly even though the PowerShell cmdlets are not coloured. In the answer, the syntax highlighting colours the cmdlets but does not recognise the comments.

I expected the two blocks to be formatted with the same style, and expected them to both format to PowerShell since the question is tagged with PowerShell.

I saw an old question from 2020 but it seems the highlighting has changed since then. Powershell and Batch syntax highlighting not working logically

I've tried changing the block to use code fences with ```powershell and I've also tried <!-- language: powershell --> and <!-- language: lang-powershell --> but the comments are still incorrectly coloured in the answer. So I looked a bit further...

Looking at https://superuser.com/tags/powershell/info I see

Code Language (used for syntax highlighting): default

Following the syntax highlighting link to highlight.js I get https://github.com/highlightjs/highlight.js/blob/main/SUPPORTED_LANGUAGES.md which indicates powershell is supported.

Reading the docs on syntax highlighting, What is syntax highlighting and how does it work? I see that PowerShell is not listed as supported on SE and that

If a language is already on the list of languages supported by highlight.js, but is not supported on Stack Exchange (see Language codes currently available on Stack Exchange below), you can raise a feature request here on Meta to ask for it to be deployed on the network.

So I guess this is a feature request to add PowerShell highlighting. Or to change its highlighting from default to something that will at least consistently format the comments as comments.

2
  • I'm not sure if the request for powershell highlighting, or indeed this question entirely, should be requested at meta.stackexchange.com but I've added a status-review tag for someone to have a look.
    – Mokubai Mod
    Commented Jun 18, 2022 at 12:17
  • @Mokubai Thanks. I'm unfamiliar with the meta side of SE so wasn't sure where this request belonged.
    – Jim
    Commented Jun 19, 2022 at 13:04

1 Answer 1

-3

We're not currently adding new languages to the list of languages that are available to have syntax highlighting. We understand that there are many languages that we could add but we don't have plans to make changes to the list at the moment.

I cover this to some degree in my answer on Meta Stack Exchange.

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.

I wrote it about a year ago but we're still not in a place where we can look into this right now. While we aren't changing this now, we are keeping track of languages that people are interested in for a time when we're able to make adjustments to the list of available languages.

3
  • While I know it's not ideal, could you consider deprecating some syntax highlighting for lesser used languages in order to make room for those that are more active? Scala, for instance, currently has syntax highlighting support, but has around one-third the weekly SO questions as PowerShell. And while it might be sacrilegious to suggest, the venerable Perl is around the same one-third level, with fewer total questions as well. Even Kotlin and Go (although I realize Google is a sponsor) are in the weeds compared to PowerShell, but you have room in the library for them at the moment. Commented Aug 10, 2022 at 19:43
  • Also noticing that Ruby/Ruby-on-rails combined come in at about half of PowerShell in weekly questions. I know they were more popular at one point, but perhaps you might consider that (oddly) PowerShell is a more popular and general-use language nowadays that you could find room for, even if it's at the expense of an "older" (declining) language. Commented Aug 10, 2022 at 19:45
  • While I agree with the notion that we cannot add this for all languages, PowerShell in this community is one of the most prevalent. I ask you to reconsider.
    – Tolga
    Commented Jun 23, 2023 at 20:47

You must log in to answer this question.

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