15

Recently, PowerShell syntax highlighting has become available in SE posts.

But one has to explicitly request that using

<!-- language: lang-powershell -->

It's not automatically used as with other languages.

Can I request that PowerShell syntax highlighting is automatically used for questions tagged ?

1
  • 1
    Unfortunately, as of late 2022, perhaps related to the switch from prettify.js to highlight.js, PowerShell syntax highlighting is broken again. Please see meta.stackoverflow.com/q/421016/45375
    – mklement0
    Commented Oct 23, 2022 at 12:51

1 Answer 1

5

Actually, lang-powershell does not event exist. It just triggers some kind of default syntax highlighting.

But so does tag since recently. So my request is kind of implemented.

See for example:
PowerShell FTP upload not working - Creating zero byte file

11
  • 1
    Looks like it defaults to lang-bsh... Doesn't appear to be a lang-powershell available from the default drop language drop down for tags... so not 100% sure this is done actually. Commented Jul 21, 2015 at 8:18
  • @JonClements OK, it seems that lang-poweshell is the same as lang-bsh. But it works reasonably well for PowerShell. Commented Jul 21, 2015 at 8:22
  • @JonClements What is "language drop down for tags"? Commented Jul 21, 2015 at 8:23
  • It's an option that mods can use to set default highlighting for tags... Commented Jul 21, 2015 at 8:24
  • As for lang-powershell - it appears to be still an open issue: code.google.com/p/google-code-prettify/issues/detail?id=295 Commented Jul 21, 2015 at 8:25
  • @JonClements Well, I'm not sure how it works internally. But since recently PowerShell code is highlighted reasonably well when powershell tag is used. Commented Jul 21, 2015 at 8:28
  • @JonClements You are right that lang-powershell indeed does not work, it just triggers some kind of default highlighting. The same what powershell tag does. Commented Jul 21, 2015 at 8:30
  • If you give an invalid language <!-- language: lang-whatever --> it ignores it and will use the default associated with the "main" tag of the question - so lang-bsh in this case Commented Jul 21, 2015 at 8:35
  • But something had to change, as before (when asked this question), the mere presence of powershell tag did not help. One had to specify (invalid) lang-powershell. Anyway, I've updated my answer. Commented Jul 21, 2015 at 8:39
  • 1
    The current behavior is quite broken, especially with respect to escape characters. If a powershell question has a \" inside it, the engine never closes the quote making the entire script look busted: stackoverflow.com/questions/34661567/…
    – Eris
    Commented Jan 7, 2016 at 22:18
  • @Eris That's true. I've seen this too. Commented Jan 8, 2016 at 7:10

You must log in to answer this question.

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