Show-UDToast multiple lines

Product: PowerShell Universal
Version: 4.2.13

Hello everyone

I want to display content of some txt file in UDToast. It easy but this Toast does not preserve line breaking form this file and everything is displayed in one row
Im think I saw somewhere here some trick with replacing `n character but im not sure it will work with UDToast and i don’t remember exactly what it was replaced with…

Any help ?

You can use HTML in the message.

New-UDApp -Title 'PowerShell Universal' -COntent {
    New-UDButton -OnClick {
        Show-UDToast -Message "Hello<br/>Nice"
1 Like

Yes indeed
Below code:

$log_content = (Get-Content -Raw -Path $EventData.Log_file)
$log_content2 = $log_content.replace("`r`n", "<br/>")

allows me to display log content from UDModal.
Not perfect but will do the job for now.

I had the conundrum where I needed to output array. I found two options using a foreach approach or a here string approach. But I wasn’t using a toast. Is there a css styling for multiple lines I wonder. If so you could use new-udstyle