6

Inconsistent syntax highlighting for reg and powershell code

(There is an intentional leading whitespace on code fence code for it to display correctly)


This was posted on Meta SE on 2024.06.26 after being told to do so to get an SE developer's attention (this has only received 64 views in 4.5months prior to the post on Meta SE), and apparently folks on Meta SE don't like that, with it receiving nothing but down-votes. This is as clear of a bug as one could possibly get, having existed for YEARS, ever since Superuser switched to its new syntax highlighting system (this was not an issue before then).

Registry [.reg] code used to display correctly, and still does on some questions/answers, however on others it doesn't, and there's no obvious reason why. Ever since Superuser switched what's used for syntax highlighting, very few Windows syntaxes [powershell/ps1, cmd/bat, reg, vbs] work correctly and they do not work the same across all questions/answers on Superuser, regardless of the Windows syntax used, which is baffling.

  • When it was first announced on 2020.09.08 highlight.js was being switched to from Prettify, I posted on 2020.10.06 the powershell and bat/cmd syntax highlighting were broken, with it coming back as status-bydesign
    • highlight.js's SUPPORTED_LANGUAGES.md supports powershell/ps1/ps, bat/cmd/dos, and while it does not list reg as a supported language, it does get syntax highlighted semi-correctly at random on Superuser

  • Per the SE supported languages list, none of these are supported, which brings two questions to the forefront:
    • Why is the syntax highlighting applying randomly to some questions/answers, and doing so semi-correctly when it does work?
    • Why are the two primary languages of Windows not on the list of SE supported languages when highlight.js supports them?
      • This in turn creates a third question because when highlight.js supports them, this seems like a conscious exclusion, which is baffling in and of itself:
        Do SE/SU developers have a bias against Windows, when Windows makes up an equal share of content on SU?



Semi-Correctly Displayed

  1. <!-- language-all: lang-powershell -->: Will randomly display .reg code correctly on some questions/answers, but not others, whereas ```powershell code fence will not (content too long to display editor)
    Unremovable items from New right-click menu
    Correct1


  1. <!-- language-all: lang-reg -->: Will randomly display .reg code correctly on some questions/answers, but not others, same for ```reg code fence
    Set windows 10 certificate import wizard as default when opening files Correct2



Incorrectly Displayed

  1. ```reg: Will randomly display .reg code correctly on some questions/answers, but not others, same for <!-- language-all: lang-reg -->
    Create .REG file to edit only single Octet at specific address in Binary Value without affecting other bytes in binary data
    Incorrect1

    Some .exe files have blank icons on taskbar despite having icons
    Incorrect2


  1. <!-- language-all: lang-reg -->:
    Some .exe files have blank icons on taskbar despite having icons
    Incorrect3


  1. <!-- language-all: lang-powershell -->:
    Some .exe files have blank icons on taskbar despite having icons
    Incorrect4



Additional Examples:

  1. 2024.02.15: Issue with powershell syntax:
    1. <!-- language-all: lang-powershell -->: incorrectly applies syntax highlighting to first code box, applies semi-correctly to every additional code box
      How can I fix this error in the DISM log file?
      Incorrect5

    2. ```powershell: incorrectly applies syntax highlighting
      How can I fix this error in the DISM log file?
      Incorrect6

      Doesn't apply syntax highlighting at all:
      How can I fix this error in the DISM log file?
      Incorrect7

    3. No language specified:
      How can I fix this error in the DISM log file?
      Incorrect8

The only way I was able to get semi-correct syntax highlighting was by using ```bash:
How can I fix this error in the DISM log file?
Incorrect9


  1. 2024.06.25: Issue with reg syntax:
    1. <!-- language-all: lang-reg -->: Edit I just did on the left, compared to the right:
      WTF

5
  • 2
    Have you reported this to Meta SE?
    – Ramhound
    Commented Jun 25 at 20:15
  • 1
    @Ramhound I haven't since I thought it needed to be reported here since each site has their own separate syntax highlighting solution (e.g. this issue doesn't occur on Stack Overflow)
    – JW0914
    Commented Jun 26 at 1:05
  • 1
    If it’s an overall bug within the syntax highlighting then only a SE developer can fix it.
    – Ramhound
    Commented Jun 26 at 1:22
  • @Ramhound Posted on Meta SE - should I close this?
    – JW0914
    Commented Jun 26 at 13:10
  • 1
    If you linked to this question, no, use this question to document it.
    – Ramhound
    Commented Jun 26 at 13:26

0

You must log in to answer this question.

Browse other questions tagged .