Highlighting HTML fragment without saving it to file

I have a PowerShell command that returns an HTML snippet:

(Get-AzureResourceGroupGalleryTemplate -Identity Microsoft.WebSiteSQLDatabase.0.3.17-preview).description

      

enter image description here

Is there a way to easily display this snippet without saving it to a file? for example is it possible to throw it into a web browser?

+3


source to share


2 answers


Create a new instance of Internet Explorer and add an HTML snippet to the body of a blank page:



$id   = 'Microsoft.WebSiteSQLDatabase.0.3.17-preview'
$html = (Get-AzureResourceGroupGalleryTemplate -Identity $id).description

$ie = New-Object -COM 'InternetExplorer.Application'

$ie.Navigate('about:blank')
do {
  Start-Sleep -Milliseconds 100
} until ($ie.ReadyState -eq 4)

$ie.Document.body.innerHTML = $html

$ie.Visible = $true

      

+3


source


Don't forget to save it to a file, but you can create 1 liner function for it:



function render-html { $input > out.html; start out.html; sleep 1; rm out.html }

"<b>meh</b>" | render-html

      

0


source







All Articles