1

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
    Jun 18 at 12:17
  • @Mokubai Thanks. I'm unfamiliar with the meta side of SE so wasn't sure where this request belonged.
    – Jim
    Jun 19 at 13:04

0

You must log in to answer this question.

Browse other questions tagged .