Need help?

I'm available for remote short term contracting or consultancy work. Please check out my LinkedIn profile for more details on my experience.

Please feel free to use the form below to contact me.




Highlight Code using jQuery and Chili

If you're maintaining a blog and want a way to highlight code within your articles (for ease of reading), then this article may interest you.

I can't even begin to say how annoying it is to read a large chunk of code that has no color highlighting - this will improve readability and traffic to your blog (or whatever you decide to use it on).

The first thing you'll need to do it download the latest Chili (jquery plugin) source from http://code.google.com/p/jquery-chili-js/downloads/list.

I'm going to assume you're following an MVC (Model View Controller) framework, so if you copy the chili directory within your js (javascript) directory that will be fine - otherwise, copy it where ever else you'd like, but you'd have to change the paths accordingly.


<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript" src="/js/chili/jquery.chili-2.2.js"></script>
<script type="text/javascript">
    ChiliBook.recipeFolder = "/js/chili/";
    //ChiliBook.lineNumbers = true;
</script>

As above, you'll have to include the main jquery library (assuming you have this already), and then include the chili plugin. For the last main step, you'll have to tell Chili where the recipes are (the language files).

I have also added a commented out option, which will add numbers to your code, which you can enable if you choose to.


<pre>
<code class="php">
(code goes here)
</code>
</pre>

And finally, you can see how easy it is to highlight the code - for this example I used PHP, but you have quite a lot of options. You can check all of them by taking a look in the Chili directory.

If that doesn't work for you, and you need something to parse code on the server side, you should check out GeSHi.


jon | April 28, 2010 | Comments (2)

Comments

cheap ray ban, http://www.raybanwayfarer.in.net/
softball bats, http://www.cheapbaseballbats.net/
burberry, http://burberry.outletnow.net/
christian louboutin shoes, http://christian.louboutin-outlet.net/
tory burch sale, http://toryburch.salesandals.net/
nike mercurial, http://www.soccer-shoes.org/
timberland boots, http://www.timberlandboots-outlet.net/
jordan release dates, http://www.retro-jordans.com/
tory burch sale, http://www.tory-burchoutlet.us.com/
tommy hilfiger outlet, http://www.tommy-hilfigeroutlet.com/
ugg australia, http://www.uggboots.so/
louis vuitton handbags, http://www.louisvuitton.so/
calvin kleins outlet, http://www.calvin-kleins.com/
christian louboutin outlet, http://www.cheap-christianlouboutinshoes.com/
air jordan 2015, http://www.airjordanshoes2015.com/
burberry, http://www.burberry2015.net/
abercrombie, http://www.abercrombiee.com/
oakley sunglasses cheap, http://www.cheapoakley.us.org/
oakley vault, http://www.oakleyoutlet.us.org/
oakley sunglasses outlet, http://www.oakleysunglassesoutlet.com.co/
swarovski crystal, http://www.swarovskijewelry.com.co/
knockoff handbags, http://www.replicahandbags.com.co/
shoes outlet, http://www.cheapshoes.com.co/
cheap basketball shoes, http://www.basketballshoes.com.co/
chanel handbags, http://www.coco-chanelbags.com.co/
true religion jeans, http://www.truereligion-outlet.com.co/
abercrombie kids, http://www.abercrombieand-fitch.com.co/
hermes belt, http://www.hermesbirkin.com.co/
lululemon, http://www.yogapants.com.co/
gucci outlet, http://www.guccishoes.us.org/
chanel bags, http://www.chanelhandbags.net.co/
ray ban sunglasses, http://www.raybansunglassesoutlet.net.co/
rolex watches, http://www.omegawatches.us.com/
glasses frames, http://www.eyeglassframes.us.com/
glasses online, http://www.eyeglassesonline.us.com/
michael kors handbags clearance, http://www.cheapmichaelkors.co.com/
ray bans, http://www.cheaprayban.co.com/
flat iron, http://www.chiflatiron.net.co/
converse outlet, http://www.converse.net.co/
ferragamo outlet, http://www.ferragamo.com.co/
gucci belts, http://www.guccihandbags.com.co/
hollister clothing store, http://www.hollister.us.org/
north face jackets, http://www.thenorthfacejackets.in.net/
the north face jackets, http://www.northclearance.com/
burbery outlet store, http://www.burberry-factory.org/
polo ralph lauren outlet, http://www.ralph-lauren.org.uk/
polo ralph lauren outlet online, http://www.polo-outlets.com/
ralph lauren outlet, http://www.ralphlaurenpolo.in.net/
insanity calendar, http://www.insanityworkout.net.co/
jimmy choo outlet, http://www.jimmychoo.net.co/
cheap jordans, http://www.jordan-shoes.com.co/
juicy couture, http://www.juicycouture.com.co/
juicy couture outlet, http://www.juicycoutureoutlet.net.co/
katespade, http://www.kate-spade.com.co/
kate spade outlet online, http://www.katespade-outlet.com.co/
louis vuitton outlet online, http://www.louisvuitton-outlet.com.co/
michael kors purses, http://www.michael--kors.us.com/
michael kors handbags clearance, http://www.michael-kors-handbags.us.com/
michael kors outlet online sale, http://www.michael-kors-outlet.us.org/
michael kors, http://www.michael-kors-outlet-online.us.org/
michael kors outlet online sale, http://www.michaelkorsoutletonline-sale.us.com/
north face outlet, http://www.northface.us.org/
oakley outlet, http://www.oakley-sunglasses.us.org/
pandora charms, http://www.pandorajewelry.com.co/
prada outlet, http://www.pradahandbags.com.co/
prada shoes for men, http://www.pradashoes.com.co/
ray-ban, http://www.ray-ban-outlet.us.com/
ray ban sunglasses outlet, http://www.rayban-sunglasses.us.org/
omega watches, http://www.replicawatches.us.com/
swarovski outlet, http://www.swarovskicrystal.com.co/
the north face outlet, http://www.thenorthface.us.org/
tiffany and co outlet, http://www.tiffanyandco.net.co/
tiffany's jewelry, http://www.tiffanyjewelry.us.org/
cheap true religion, http://www.true-religion.com.co/
true religion jeans women, http://www.truereligionjeans.net.co/
uggs, http://www.uggaustralia.net.co/
ugg boots clearance, http://www.uggboots.net.co/
uggs on sale, http://www.uggbootsclearance.com.co/
ugg boots, http://www.uggsonsale.com.co/
ugg outlet, http://www.uggsoutlet.com.co/
oakley sunglasses, http://www.cheap-oakleysunglasses.in.net/
cheap oakley sunglasses, http://www.oakleysunglassescheap.in.net/
ralph lauren outlet online, http://www.ralphlaurenoutletonline.in.net/
ralph lauren outlet, http://www.ralphlaurenoutlet.co.com/
burberry outlet, http://www.burberryoutlet-online.in.net/
toms outlet, http://www.toms-shoes.com.co/
toms shoes, http://www.toms-outlet.in.net/
christian louboutin shoes, http://www.christian--louboutin.in.net/
tory burch sale, http://www.tory-burch-outlet.in.net/
gucci handbags, http://www.gucci-outlet.in.net/
longchamp handbags, http://www.longchamphandbagsoutlet.co.com/
abercrombie and fitch, http://www.abercrombiekids.co.com/
hollister clothing store, http://www.hollisterclothing-store.in.net/
hermes belt, http://www.hermesbags.co.com/
baseball jerseys, http://www.cheapjerseys.in.net/
dre beats, http://www.beatsbydre.co.com/
beats by dre, http://www.beatsheadphones.in.net/
straightener, http://www.ghdhairstraightener.co.com/
ray ban, http://www.rayban-sunglasses.org.uk/
michael kors, http://www.michaelkors-uk.org.uk/
michael kors handbags, http://www.michaelkorshandbags.org.uk/
marc jacobs handbags, http://www.marcjacobsonsale.com/
louis vuitton bags, http://www.louis--vuitton.org.uk/
ralph lauren uk, http://www.ralphlauren-outlet.org.uk/
free running, http://www.nikefree-run.org.uk/
replica watches, http://www.rolex-watches.me.uk/
wedding dress, http://www.weddingdressesuk.org.uk/
pandora uk, http://www.pandora-charms.org.uk/
thomas sabo uk, http://www.thomassabo-uk.org.uk/
swarovski uk, http://www.swarovski-uk.org.uk/
louboutin, http://www.christianlouboutin.org.uk/
air huarache, http://www.air-huarache.co.uk/
roshe run, http://www.rosherun.org.uk/
the north face, http://www.thenorth-face.org.uk/
louis vuitton, http://www.louis--vuitton.ca/
air jordans, http://www.airjordans.us/
retro jordans, http://www.jordanretro.org/
air jordan shoes, http://www.cheap-jordans.net/
nike factory outlet, http://www.nikefactory.org/
nike store, http://www.nikestore.us/
nike outlet, http://www.cheap-nikeshoes.com/
nike air max 2014, http://www.nike-air-max.us/
air max 2015, http://www.airmax-2015.org/
nike air max, http://www.airmax-90.org/
free run, http://www.nikefree-run.net/
nike free 5.0, http://www.nikefree5.net/
supra footwear, http://www.suprashoe.net/
new balance shoes, http://www.newbalance-outlet.org/
mont blanc, http://www.montblanc--pens.net/
ferragamo, http://www.ferragamoshoes.net/
mcm handbags, http://www.mcm-bags.net/
bottega veneta, http://www.bottega.us/
soccer shoes, http://www.nikemercurial.net/
celine bags, http://www.celinebags.org/
roshe runs, http://www.rosheruns.us/
nike roshe run, http://www.nikerosherun.us/
vans outlet, http://www.vansshoes.us/
timberland shoes, http://www.timberland-shoes.com/
ipad cases, http://www.iphone-cases.us/
softball bats, http://www.softball-bats.us/
babyliss, http://www.babyliss-pro.net/
louis vuitton outlet, http://www.louisvuitton-outlets.us/
burberry outlet, http://www.burberry-outlet.jp.net/
louboutin shoes, http://www.louboutin.jp.net/
christian louboutin outlet, http://www.christianlouboutinshoes.jp.net/
louis vuitton, http://www.louisvuitton.jp.net/
prada handbags, http://www.official-pradaoutlet.com/
michael kors clearance, http://www.michaelkorsclance.com/
michael kors outlet online sale, http://www.official-michaelkorsonline.com/
tommy hilfiger kids, http://www.tommyhilfiger.net.co/
mcm world wide, http://www.mcmworldwide.ca/
moncler outlet, http://www.mmoncler-outlet.com/
kate spade outlet, http://www.kate-spades.com/
barbour womens, http://www.barbour-factory.com/
ferragamo shoes, http://www.salvatoreferragamo.in.net/
canada goose sale, http://www.canada-gooser.com/
louis vuitton, http://www.louisvuittonas.com/
burberry outlet online, http://www.burberryoutlet.org.uk/
juicy couture clothes , http://www.fashion-clothing.us.com/
north face, http://www.thenorthface.so/
barbour jacket sale, http://www.barbour-jacketsoutlet.com/
beats by dre outlet, http://www.monsterbeatsbydres.net/
louis vuitton sale, http://www.louis-vuittonblackfriday.com/
gucci shoes outlet, http://www.lv-guccishoesfactory.com/
longchamp outlet, http://www.longchampsoutlet.com/
moncler outlet online, http://www.moncler-clearance.com/
ralph lauren polos, http://www.ralphlaurentshirts.com/
michael kors handbags, http://www.usahanbags.com/
monster beats, http://www.beatsbydreoutlet.net/
coach outlet online, http://www.coach-blackfriday2014.com/
coachoutlet.com, http://www.coachccoachoutlet.com/
coach store outlet online, http://www.coach-clearance.com/
michael kors outlet, http://www.michaelkorsbags.us.org/
coach factory outlet, http://www.coach-factories.net/
oakley outlet, http://www.oakley.so/
hermes, http://www.hermes-outletonline.com/
nike jordan shoes, http://www.nike-jordanshoes.com/
woolrich outlet, http://www.woolrich-clearance.com/
coach outlet online, http://www.coachoutlet.so/
coach outlet online usa, http://www.coachoutletrusa.com/
gucci shoes uk, http://www.guccishoes-uk.com/
coach black friday, http://www.uptocoachoutlet.com/
michael kors outlet online, http://www.michaelkors.so/
gucci bags, http://www.guccifactorys.com/
the north face outlet online, http://www.the-northface.in.net/
ugg boots, http://www.cheapuggboots.eu.com/
ray ban outlet, http://www.raybans.co.com/
toms outlet, http://www.tomshoesoutlet.com/
Comment by www - May 18, 2015 @ 10:06 pm
http://sellgoldmanhattan.com/
Comment by Every weekend i used to go to see this web site, as i wish for enjoyment, as this this site conati - January 20, 2015 @ 3:36 pm

Name (required)
Email (will not be published) (required)
Website

captcha