Anyway to keep spaces and line breaks in UD?


#1

Hey Everyone,

Am I missing something… is there a way to keep spaces and line breaks in UD? When I try and create any string with line breaks or multiple spaces UD removes them all.

Example

Automation Job Output in PS

image


#2
  • Sorry for double post, only allowed to upload 1 image at a time :expressionless:

then the same result in UD


#3

Hmmm. Seems like it should account for this.

You might be able to get around this by doing something like this. This replaces the new line characters with the HTML
tag.

$Html = New-UDHtml "<div>$($AzureRMAutomationJobOutput.Replace('`n', '<br/>'))"
New-UDCard -Content { $Html }

#4

Thanks Adam - I just tired it quickly and getting the same result. Ill spend some time with it later to see if it was my copy/paste skills.


#5

I’ve preserved formatting in Cards using Here Strings before and it worked.

$body = @"
This is line 1

Testing:
This is a paragraph
            
"@

New-UDCard  -Title "Test" -Text $body