Interesting night for me, as I’ve spent the last 4 hours fumbling around in the Google dark trying to find a way to take “comments” for the team.silverlight blog, sanitize them but preserve their natural format in which the user typed them.
In that for example, I like to sign my signature in most comments on blogs like this:
Rich Platforms Product Manager
3 Lines basically, but to do this in most of the libraries I've seen, they always end up like this:
- Scott Barnes Rich Platforms Product Manager Microsoft.
The only way i can preserve the said format, is to use <pre> tags and via CSS make them look more natural.
The downside, is I then sacrifice basic html which is one feature I want to implement.
Any magical RegEx formulas out there than can handle both shift+linefeed as well as preserve double space line feeds with <p></p> tags I’m all ears.
As the intended format of a comment should end up like this:
<p> Your comment goes here </p> <p> -<br /> Scott Barnes</br> Rich Platforms Product Manager </br> Microsoft</br> </p>