Pragmatism in code


Waxing lyrical about life the universe and everything software related since lunchtime 2006.

Syntax highlighting code in TinyMCE

After a recent tutorial a member mailed me to let me know that the code snippets were not displaying correctly. A quick look told me that this was due to my use of the pre tag, which prevented the text from breaking when it reached the bounds of it's containing element.

The fix was relatively easy - add the following hacks to force the text to wrap for pre formatted text...

word-wrap: break-word; /* Internet Explorer 5.5+ */ white-space: -o-pre-wrap; /* Opera 7 */ white-space: -pre-wrap; /* Opera 4-6 */ white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */ white-space: pre-wrap; /* css-3 */

But this got me thinking, and jarred my memory to something I was working on a little while back.

I had previously taken a look at syntax highlighting for WYSIWYG editors, this was for use in the DMCMS project where i wanted to allow full editing of template files from within the Admin panel. This is something that I had implemented on an earlier development version but had then abandoned. (For some reason that i can no longer remember)

Continue reading
  8232 Hits
8232 Hits