Have you ever wanted to publish Powershell code (or other languages) directly to a WordPress blog such that it automatically is syntax colored and line numbered? Now you can! Here’s how:
- Download Syntax Highlighter Evolved WordPress Plugin and install it on your Worpress installation (https://wordpress.org/plugins/syntaxhighlighter/)
- Install Source Code plugin for Windows Live Writer (http://sourcecodeplugin.codeplex.com/)
- From your WordPress Dashboard, select Settings / SyntaxHighlighter and check the box Load All Brushes
- From Live Writer select Insert from the ribbon and choose
- Copy and paste your powershell code into the window and be sure to select the Code Language as powershell and press OK
# This is some sample Powershell # It doesn't do anything of value $Result = Get-Service | Where { $_.DisplayName -match "Update" } $Result = $Result.DisplayName | select -first 1 Write-host "The service $Result is present" -BackgroundColor Yellow
- Publish your blog post and enjoy the nicely formatted Powershell code
1 comments
It’s remarkable in support of me to have a site, which is beneficial for my knowledge.
thanks admin