I needed to post some code in an article / tutorial I am writing for beginners learning nuke modules. I soon realized that nuke wysiwyg didn't have much capiblity for that. So that lead me to another mission and what I found changed me forever. I would like to introduce syntax highlighting for Nuke Wysiwyg 2.6.4.1. I did make some minor changes, but 99% of the code was already done for me. I simply integrated it into an already brilliant nuke hack.
Basic Features:
- Highlighting available for ActionScript, Bash/Shell, C#, C++, CSS, Delphi, Diff, Groovy, Javascript, Java, JavaFX, Perl, PHP, Plain Text, Powershell, Python, Ruby, Scala, SQL, Visual Basic, XML (please see note about XML)
- Print Highlighted Code
- Plain Text View
- Copy to Clipboard
- Focus attention on specific lines
- Custom Highlighting Themes
- much more...
Requirements:
Nuke Wysiwyg from NukeSeo.com (registration required)
Original Authors:
http://psykoptic.com/ (FCKEditor Plugin for SyntaxHighlighter)
http://alexgorbatchev.com/ (Author of SyntaxHighlighter)
Download:
http://www.clanthemes.com/downloaddetails-46-895-nuke-wysiwyg-syntax-highlighting.html
Installation:
Step 1) Download and extract Nuke_Wysiwyg_Syntax_Highlighting.zip. Upload the contents of the html folder to your nuke root.
Step 2) Open nuke_root/includes/fckeditor/fckconfig.js
Find
FCKConfig.PreloadImages = [ FCKConfig.SkinPath + 'images/toolbar.start.gif', FCKConfig.SkinPath + 'images/toolbar.buttonarrow.gif' ] ;
FCKConfig.PluginsPath = FCKConfig.BasePath + 'plugins/' ;
Below On A New Line Add
// ----------------------
// Configure Syntax highlighter for 2.0.x
FCKConfig.Plugins.Add('syntaxhighlight2', 'en');
// default language options:
// c++,csharp,css,delphi,java,jscript,php,python,ruby,sql,vb,xhtml
FCKConfig.SyntaxHighlight2LangDefault = 'php';
//
// ----------------------
Find
FCKConfig.ToolbarSets["PHPNukeAdmin"] = [
['Source','FitWindow','ShowBlocks','DocProps','-','Save','NewPage','-','Templates'],
['Cut','Copy','Paste','PasteText','PasteWord','-','SpellCheck','Print'],
['Undo','Redo','-','Find','-','SelectAll','RemoveFormat'],
['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'],
['OrderedList','UnorderedList','-','Outdent','Indent','Blockquote','CreateDiv'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'],
['Link','Unlink','Anchor'],
'/',
['Image','Flash','Table','Rule','Smiley','SpecialChar','PageBreak'],
['Style','FontFormat','FontName','FontSize'],
['TextColor','BGColor'],
['-','About',]
] ;
Change To
FCKConfig.ToolbarSets["PHPNukeAdmin"] = [
['Source','FitWindow','ShowBlocks','DocProps','-','Save','NewPage','-','Templates'],
['Cut','Copy','Paste','PasteText','PasteWord','-','SpellCheck','Print'],
['Undo','Redo','-','Find','-','SelectAll','RemoveFormat'],
['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'],
['OrderedList','UnorderedList','-','Outdent','Indent','Blockquote','CreateDiv'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'],
['Link','Unlink','Anchor'],
'/',
['Image','Flash','Table','Rule','Smiley','SpecialChar','PageBreak'],
['Style','FontFormat','FontName','FontSize'],
['TextColor','BGColor'],
['SyntaxHighLight2','-','About',]
] ;
Save and Re-Upload to your nuke_root/includes/fckeditor folder.
Step 3) Open nuke_root/header.php
Find
echo "</head>";
On a new line above add
echo '<script type="text/javascript" src="includes/syntax/scripts/shCore.js"></script>
<script type="text/javascript" src="includes/syntax/scripts/shBrushBash.js"></script>
<script type="text/javascript" src="includes/syntax/scripts/shBrushCpp.js"></script>
<script type="text/javascript" src="includes/syntax/scripts/shBrushCSharp.js"></script>
<script type="text/javascript" src="includes/syntax/scripts/shBrushCss.js"></script>
<script type="text/javascript" src="includes/syntax/scripts/shBrushDelphi.js"></script>
<script type="text/javascript" src="includes/syntax/scripts/shBrushDiff.js"></script>
<script type="text/javascript" src="includes/syntax/scripts/shBrushGroovy.js"></script>
<script type="text/javascript" src="includes/syntax/scripts/shBrushJava.js"></script>
<script type="text/javascript" src="includes/syntax/scripts/shBrushJavaFX.js"></script>
<script type="text/javascript" src="includes/syntax/scripts/shBrushJScript.js"></script>
<script type="text/javascript" src="includes/syntax/scripts/shBrushPhp.js"></script>
<script type="text/javascript" src="includes/syntax/scripts/shBrushPlain.js"></script>
<script type="text/javascript" src="includes/syntax/scripts/shBrushPython.js"></script>
<script type="text/javascript" src="includes/syntax/scripts/shBrushRuby.js"></script>
<script type="text/javascript" src="includes/syntax/scripts/shBrushScala.js"></script>
<script type="text/javascript" src="includes/syntax/scripts/shBrushSql.js"></script>
<script type="text/javascript" src="includes/syntax/scripts/shBrushVb.js"></script>
<script type="text/javascript" src="includes/syntax/scripts/shBrushXml.js"></script>
<link type="text/css" rel="stylesheet" href="includes/syntax/styles/shCore.css"/>
<link type="text/css" rel="stylesheet" href="includes/syntax/styles/shThemeDefault.css"/>';
echo '<script type="text/javascript">';
echo "SyntaxHighlighter.config.clipboardSwf = 'includes/syntax/scripts/clipboard.swf';
SyntaxHighlighter.all();
</script>";
You can customize the look of your highlighting with one of the included themes or design your own. I changed it here on Clan Themes just for demo. All you have to do is change the .css name in the above code. (example below)
Find
<link type="text/css" rel="Stylesheet" href="/styles/shThemeDefault.css"/>
Change to
<!--Or Whatever you pick-->
<link type="text/css" rel="Stylesheet" href="/styles/shThemeEmacs.css"/>
Save and Re-Upload to your nuke_root/ folder.
Usuage:
I only added it to the admin side of Nuke Wysiwyg to avoid potential security risks (I am testing for public side use). In your news->admin for instance you will see a new tag beside the about image on the toolbar.

When you click it you are going to see a new window like the image below.

All you simply have to do is paste your code in that box and hit ok. For more specific control you should check out the advanced tab. For full docmentation please visit the SyntaxHighlighter Wiki.
Post in the forums if you have trouble installing.
Floppy,
Clan Themes