Highlight a substring
Options
Comments
-
Util.WordRun (true, Util.Highlight ("hello"), "world")
-
And if the string is in the middle and appears multiple times? I've to split it and use Highlight?
-
Util.WordRun (true, "start", Util.Highlight ("middle"), "end")
Or:Util.RawHtml ("start <span class='highlight'>middle</span> end")
If this is too clumsy, would writing a helper method in My Extensions solve it for you? -
Ok, I obtain an error with RawHtml if the string contains < or >, for example if it starts with <.
-
Yes it would be very useful! I did it in my extensions but for the error above it is a little bit complex.
-
It should alse be useful to have a more tolerant Util.RawHtml method to allow dumping any HTML, also malformed or a full html.
-
The whole Dump pipeline is built around XElement, so I have no way to represent malformed HTML.