FCKeditor and SyntaxHighlighter
posted Sun, 23 Mar 2008 14:29:06 +1300 by Jed
tagged

As I edit my site, I'll be posting little code snippets that helped me, and might help you as well. If it seems a bit vege, tough, deal with it :P

So,as I'll be often posting code snippets, I'm adding SyntaxHighlighter, a small, free JavaScript tool to stylise my code. But, I want to be able to post this in easily, using FCKeditor. So, I added this to my fckstyles.xml file:

<Style name="C# Code" element="pre">
	<Attribute name="name" value="code" />
	<Attribute name="class" value="c-sharp" />
</Style>
	
<Style name="php Code" element="pre">
	<Attribute name="name" value="code" />
	<Attribute name="class" value="php" />
</Style>
	
<Style name="SQL Code" element="pre">
	<Attribute name="name" value="code" />
	<Attribute name="class" value="sql" />
</Style>

Nothing fancy, but it works well. And, as an added bonus, FCKeditor will automatically convert the <'s to &lt; for me, as required by SyntaxHighliter.

Comments:
Mathew Schofield commented Sat, 29 Nov 2008 11:50:46 +1300

Thank you!!

Name:
Email:
Website (optional):
Comment: