Cotonti / Open Source PHP Content Management FrameworkContent Management Framework

Forums / Cotonti / Extensions / SyntaxHighlighter - Custom Brushes

Hodges
#1 2014-05-02 13:49

Hi Trustmaster,

I was looking at this page http://www.undermyhat.org/blog/2009/09/list-of-brushes-syntaxhighligher/ that offers custom brushes for syntaxhighligter outside the standard set. How would I include these extra brushes into your plugin? At the moment the default brushes are all merged together in syntaxhighlighter/lib/scripts/shAll.min.js.

For example if I wanted to add shBrushLatex.js could this be appended into line 25 of syntaxhighlighter/syntaxhighlighter.footer.php, for example?

Thanks,
Hodges

Macik
#2 2014-05-02 16:19

As I remember… not. You can not just add addition styles this way.

To add it you must do these steps:

Replace:

$sh_core_js = $cfg['plugins_dir'] . '/syntaxhighlighter/lib/scripts/shAll.min.js';

cot_rc_embed_footer(<<<JS
$(function(){if($('pre').length>0){ $('head').append('$sh_core_css');$('head').append('$sh_theme_css');var sh_e1=document.createElement('script');sh_e1.async=true;sh_e1.src ='$sh_core_js';document.getElementById('body').appendChild(sh_e1);}});
JS
);

With something like this (I'm not check the actual code): 

	$sh_core_js = $cfg['plugins_dir'] . '/syntaxhighlighter/lib/scripts/shCore.js';
	$sh_autoloader_js = $cfg['plugins_dir'] . '/syntaxhighlighter/lib/scripts/shAutoloader.js';

cot_rc_embed_footer(<<<JS
$(function(){if($('pre').length>0){ $('head').append('$sh_core_css');$('head').append('$sh_theme_css');var sh_e1=document.createElement('script');sh_e1.async=true;sh_e1.src ='$sh_core_js';$('body').append(sh_e1);
var sh_e2=document.createElement('script');sh_e2.async=true;sh_e2.src ='$sh_autoloader_js';$('body').append(sh_e2);
}});
JS
);

We load 2 files (shCore.js, shAutoloader.js) instead of `shAll.min.js`

Any way, look at doc for autoloader — http://alexgorbatchev.com/SyntaxHighlighter/manual/api/autoloader.html

 

https://github.com/macik
правильный хостинг — https://goo.gl/fjCa1F

This post was edited by Macik (2014-05-02 16:33, 4 years ago)