Add syntax highlight to all shell code blocks #9445
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please read #9434 (comment) as for the motivation why, as well as why use
bash
specifically (mainly for semantic reasons)As for using powershell for Windows-specific commands over cmd/batch:
Full explanation with examples (linked comment)
As far as https://github.com/github/linguist/blob/master/lib/linguist/languages.yml#L6204 is concerned,
shell
,sh
,shell-script
,bash
andzsh
are all the same, and look fine.bash
shell
powershell
empty
It doesn't outright break the syntax, if anything it highlights that you need to replace this part. It also correctly handles comments and inline commands.
Editors may have different implementations. This is in VSCode with popular markdown syntax highlight (and github-like previewer) that I use:

This is with plugins disabled:

You can see here that "shell" isn't naturally supported in the preview. (code syntax highlight has no difference). But I wouldn't use that as an argument.
Of course the exact look will depend on the editor's implementation.
In any case, having a language specifier here only seems better than no language specifier.
Another reason to use bash specifically, from a purely semantic point of view, is that the doc seems to assume all commands are to be run on linux, where afaik bash (or bash-like) is most often the default. (and bash-like code usually works in powershell on Windows)