UPDATE (Oct 23, 2006): This version of XHTMLParagraphFormat()
is out of date. If you wish, you should check out the latest version.
While reworking the athletics site, I realized that it was time to improve our less than perfect method for displaying news stories as HTML. The first obvious solution for formatting a chunk of text is ColdFusion’s built-in ParagraphFormat()
, but it is not perfect because it doesn’t return valid XHTML. A quick Google search brought me to some XHTMLParagraphFormat functions that were ok, but didn’t fit the needs of the project. I was looking for a function that would take a chunk of text with some possible XHTML already mixed in (for lists and headings and such) and nicely put paragraphs into paragraphs and give single line breaks their <br/>.
Introducing XHTMLParagraphFormat()
. While this function hasn’t been entirely tested yet and I am sure that there are some bugs, it has been working quite well in our beta application.
Please let me know if you end up using this function. And if you have any suggestions, please leave them in the comments.
Leave a Reply