If you ever struggled with converting new lines to "br" tags and keep the new lines inside the "pre" tags, then you will value this:
Although CodeIgniter has a nl2br_except_pre() function, it ignores the "pre" tags with attributes.
I've quickly looked through the official documentation of the nl2br() function just to save some time, and found a solution at the bottom of the page by Greywyvern. Unfortunetly it was too complex, so I modified it to my needs.
Press 'read more' to download the code.