Render badges with PowerShell MarkdownPS and shields.io
Alex Sarafian
Posted on April 6, 2020
Originally poste here
In my previous post Generate markdown from PowerShell with MarkdownPS I explained the basic cmdlets of the PowerShell module MarkdownPS.
Shields.io provides many interesting badges out of the box, but there is also an API that can be used to render any badge.
https://img.shields.io/badge/<SUBJECT>-<STATUS>-<COLOR>.svg
On version 1.4 of the MarkdownPS a new parameter set was added to the New-MDImage
cmdlet to drive this api.
New-MDImage -Subject "<SUBJECT>" -Status "<STATUS>" -Color red
Renders
![](https://img.shields.io/badge/%3CSUBJECT%3E-%3CSTATUS%3E-red.svg)
The produced url in the image is url encoded. The parameter -Color
accepts only values that the shields.io API allows.
Color | Badge |
---|---|
brightgreen | |
green | |
yellowgreen | |
brightgreen | |
yellow | |
orange | |
red | |
lightgrey | |
blue |
To make a badge clickable then use the -Link
parameter like this
New-MDImage -Subject "example.com" -Status "OK" -Color green -Link "https://example.com"
💖 💪 🙅 🚩
Alex Sarafian
Posted on April 6, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.