Highlight Bash/shell code in Markdown Readme.md files
Today in this article, we will see how to Highlight Bash, and shell code in Markdown Readme.md files, or wiki files for Git.
Today we will cover below aspects in this article,
We shall cover a few useful commands used for various CLI tools like,
- Shell
- Bash
- Powershell
- DOS
Command Pattern
Below is the general pattern for highlighting the code using the language of your choice,
```<Language> ///Your code here ```
Shell – Using Console for bash/shell code in Markdown
Highlight Bash/shellcode in Markdown files using console commands can be done using below naming pattern,
Example
```console thecodebuzz@DESKTOP-NUEMRRD:~$ sudo service redis-server restart Stopping redis-server: redis-server. Starting redis-server: redis-server. ```
GitHub preview
Below is how the preview looks with syntax highlighter in GitHub,
Bash – Using Bash/shell command in Markdown
HighHighlight Bash/shellcode in Markdown files using bash/shell commands as below,
```sh thecodebuzz@DESKTOP-NUEMRRD:~$ sudo service redis-server restart Stopping redis-server: redis-server. Starting redis-server: redis-server. ```
OR
```bash thecodebuzz@DESKTOP-NUEMRRD:~$ sudo service redis-server restart Stopping redis-server: redis-server. Starting redis-server: redis-server. ```
Powershell – Using the Powershell command in Markdown
We can also Highlight Bash/shellcode in Markdown files using PowerShell commands as below,
```powershell thecodebuzz@DESKTOP-NUEMRRD:~$ sudo service redis-server restart Stopping redis-server: redis-server. Starting redis-server: redis-server. ```
Using DOS- Using Powershell command in Markdown
We can use DOS commands like dos, bat, cmd
Example
```bat thecodebuzz@DESKTOP-NUEMRRD:~$ sudo service redis-server restart Stopping redis-server: redis-server. Starting redis-server: redis-server. ``` ```cmd thecodebuzz@DESKTOP-NUEMRRD:~$ sudo service redis-server restart Stopping redis-server: redis-server. Starting redis-server: redis-server. ``` ```DOS thecodebuzz@DESKTOP-NUEMRRD:~$ sudo service redis-server restart Stopping redis-server: redis-server. Starting redis-server: redis-server. ```
That’s All,
References:
Do you have any comments or ideas or any better suggestions to share?
Please sound off your comments below.
Happy Coding !!
Please bookmark this page and share it with your friends. Please Subscribe to the blog to receive notifications on freshly published(2024) best practices and guidelines for software design and development.