Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Use the GitHub markdown service to convert md to html via powershell.
[CmdletBinding()] Param (
[Parameter(Position = 0, Mandatory = $True, ValueFromPipelineByPropertyName = $True)]
function ConvertFrom-md($mdText){
$response = Invoke-WebRequest -Uri '' -Method Post -body "$mdText" -ContentType "text/plain"
return $response.Content
#get the full path
$fullPath = Resolve-Path $filePath
#Get Text
$mdt = [String]::Join([environment]::NewLine, (Get-Content $fullPath)); #Get-Content loses linebreaks for some reason.
#Convert And Save to a temp file (warning, will overwrite)
(ConvertFrom-md $mdt) | Out-File $env:TEMP\markdown.html
#Launch in browser
& start iexplore $env:temp\markdown.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.