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
andbat
/cmd
syntax highlighting were broken, with it coming back asstatus-bydesign
- highlight.js's
SUPPORTED_LANGUAGES.md
supportspowershell
/ps1
/ps
,bat
/cmd
/dos
, and while it does not listreg
as a supported language, it does get syntax highlighted semi-correctly at random on Superuser
- highlight.js's
- 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?
- 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:
Semi-Correctly Displayed
<!-- 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
<!-- 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
Incorrectly Displayed
```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
Some .exe files have blank icons on taskbar despite having icons
<!-- language-all: lang-reg -->
:
Some .exe files have blank icons on taskbar despite having icons
<!-- language-all: lang-powershell -->
:
Some .exe files have blank icons on taskbar despite having icons
Additional Examples:
- 2024.02.15: Issue with
powershell
syntax:<!-- 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?
```powershell
: incorrectly applies syntax highlighting
How can I fix this error in the DISM log file?
Doesn't apply syntax highlighting at all:
How can I fix this error in the DISM log file?
- No language specified:
How can I fix this error in the DISM log file?
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?