Method Of(string?)
The value with its line breaks escaped; an absent value is an empty text.
public static string Of(string? value)
Remarks
Every value goes through the replacements, with no early return for a value without line breaks: a code scanner
(CodeQL's log forging query) takes of a line break as the sanitizer
and cannot see that a guard made the replacement unneeded, so a shortcut path reads as an unsanitized log entry.
A replacement that finds nothing returns the same string without copying it.