#PSTip GitHub PowerShell syntax highlighting in Markdown

GitHub, a service for hosting development projects that can be written in many programing and scripting languages has its own extensions to the popular Markdown style. This allows us to add syntax highlighting in our Markdown files inside of our repositories (like the README.md file). Also, when opening  Issues, Pull Request and even on the  Wiki we can use it in code blocks to syntax highlight code following one of the supported language types.

The way we specify what type of syntax highlighting should be used for processing the code block is by adding at the front of the triple backtick marker used by Github the name of the language. In the case of PowerShell it would be:



Here is an example of an advanced function template:

   Short description
   Long description
   Example of how to use this cmdlet
   Another example of how to use this cmdlet
function Verb-Noun


        # Param1 help description

        # Param2 help description




GitHub would render this in the following manner:


If you plan to use Markdown files in your project to document it or to generate documentation you will later export to HTML or PDF, you can also use a program called MarkdownPad 2 Pro . The Pro version allows use of the GitHub Markdown Engine in its Options.


This works great when one wants to edit the Markdown files locally and see a preview of how they would look rendered.


About the author: Carlos Perez

Carlos Perez works as the Director of Reverse Engineering at a security vendor. He is very active in security open source community contributing to projects like Metasploit, Kali Linux and his own tools in several languages. He is also a host of the PauldotCom Security Weekly Podcasts and presents and teaches at security conferences like BSides, Hack3rcon, Derbycon and others. You can find more on him at his blog at www.darkoperator.com

Related Posts