Markitup and highlighter plugins for croogo

 | Mar 25, 2010

I implemented two plugins for Croogo: a Markitup plugin and a syntax highlighting plugin.

They are not finished yet, but in a usable state already - I use both of them to write this post. Wink

The highlighter plugin is very simple indeed, only a helper:

class HighlighterHookHelper extends AppHelper {
/**
 * Other helpers used by this helper
 *
 * @var array
 * @access public
 */
    var $helpers = array(
        'Html',
        'Js',
    );
/**
 * Before render callback. Called before the view file is rendered.
 *
 * @return void
 */
    function beforeRender() {
		echo $this->Html->css('/highlighter/css/shCore');
		echo $this->Html->css('/highlighter/css/shThemeRDark');
		echo $this->Html->script('/highlighter/js/shCore.js');
		echo $this->Html->script('/highlighter/js/shBrushBash.js');
		echo $this->Html->script('/highlighter/js/shBrushCSharp.js');
		echo $this->Html->script('/highlighter/js/shBrushCpp.js');
		echo $this->Html->script('/highlighter/js/shBrushCss.js');
		echo $this->Html->script('/highlighter/js/shBrushDelphi.js');
		echo $this->Html->script('/highlighter/js/shBrushDiff.js');
		echo $this->Html->script('/highlighter/js/shBrushJScript.js');
		echo $this->Html->script('/highlighter/js/shBrushPerl.js');
		echo $this->Html->script('/highlighter/js/shBrushPhp.js');
		echo $this->Html->script('/highlighter/js/shBrushPlain.js');
		echo $this->Html->script('/highlighter/js/shBrushPowerShell.js');
		echo $this->Html->script('/highlighter/js/shBrushPython.js');
		echo $this->Html->script('/highlighter/js/shBrushRuby.js');
		echo $this->Html->script('/highlighter/js/shBrushScala.js');
		echo $this->Html->script('/highlighter/js/shBrushSql.js');
		echo $this->Html->script('/highlighter/js/shBrushVb.js');
		echo $this->Html->script('/highlighter/js/shBrushXml.js');
      echo $this->Html->scriptBlock("
	SyntaxHighlighter.config.clipboardSwf = '/highlighter/js/clipboard.swf';
	SyntaxHighlighter.config.stripBrs = true;
	SyntaxHighlighter.defaults['wrap-lines'] = true;
	SyntaxHighlighter.all();
");
    }
}

I use a Code button and a Encode HTML characters button in the Markitup editor, and it works great.Smile

I like that the editor doesn't mess around with the code / markup behind my back.

Markitup is a jQuery powered markup editor, which is very configurable and low impact - highly recommended.

It looks like this in action:


You can download both plugins here:

croogo_highlighter_0_1.zip

croogo_markitup_0_1.zip

Though I hope that it will become included in Croogo, at least the Markitup plugin Laughing

I am totally new to jQuery, and haven't implemented the file upload hook for the Markitup plugin yet.

If anyone implements that, I'll be happy to update the download.

And the highlighter plugin could do with a proper options 'screen', instead of requiring you to hack the helper script to use a different theme.

And the editor does currently only spit out a 'php' code tag..

So, obviously: To be continued. Wink

Comments Comments (8)  | Last updated on Dec 21, 2010


blog comments powered by Disqus

comments

#1
Andrew
Mar 26, 2010
Hey great work. I have a few plugins planned to release shortly. Great to have more support in the Croogo community!
#2
Jacob Moen
Mar 26, 2010
Thanks for the comment! :)
#3
Ishi
Apr 13, 2010

To make these work with Croogo 1.3 I needed to create a "plugin.yml" file in the webroot directory. Example below:

------------------------------------------
name: PluginName
description: Integrates PluginName into Croogo

author: NA
authorEmail: NA
authorUrl: NA
---------------------------------

#4
Jacob Moen
Apr 14, 2010
I know - I'll create a Github repository, even though I've got a Google code project for it, to make it easier for you to contribute and/or get the latest version. :)
#5
Jacob Moen
Apr 14, 2010
Since I fixed the view component issue in my plugins, I guess I need to upload them to Google Code and GitHub - stay tuned..
#6
Fahad
Apr 14, 2010
also thank Heiner Gassen http://github.com/kitten for finding the error ;)
#7
Jacob Moen
Apr 15, 2010
Thanks to Heiner Gassen for helping to fix this issue. :) I'll probably create a repo at GitHub later today - and make a new post when it's ready.
#8
Jacob Moen
Apr 15, 2010
I made an announcement: the plugins are hosted at Github now. :)