views:

347

answers:

4

I'm trying to put together a blog, and have gone with SubText and I've just installed SyntaxHighlighter but it doesn't seem to work properly. SubText or FCKEditor seems to tamper with the HTMl, inlineing everything in the pre tags and placing line-breaks at the end of each line.

Bad times!

Anyone know how to stop this?

A: 

This is caused by how each browser implements HTML design mode, and unfortunately, they all seem to mangle perfectly good HTML. There's no option to prevent this behavior, but some post processing could be done with JavaScript using regular expressions to tidy things up (or using a JS HTML parser.)

Zach
+1  A: 

in FCKEditor its related to a bug in IE where innerHTML is rendered incorrectly in pre tags. Its a common problem.

I've written a plugin for FCKEditor that uses SyntaxHighlighter to format code correctly. You can read about it here.

Darren
A: 

I know its not FCKEditor or SubTexts one, but TinyMCE has a flag that will format the HTML properly for you in its HTML view.

apply_source_formatting : true

and it will format all the HTML psuedo-properly. Not brilliant but better than the usual drag it all on to one line and make it really hard nigh impossible to read.

+1  A: 

The nuclear option is to simply switch to the plain text editor by changing

<BlogEntryEditor defaultProvider="FCKeditorBlogEntryEditorProvider">

to

<BlogEntryEditor defaultProvider="PlainTextBlogEntryEditorProvider">

An even better option is to post using Windows Live Writer. Subtext supports WLW very well. http://windowslivewriter.spaces.live.com/default.aspx?wa=wsignin1.0&amp;sa=860053782

Haacked