Welcome Guest, Not a member yet? Register   Sign In
How to display code samples on a blog page ?
#1

[eluser]opel[/eluser]
I have almost finished writing my blog and hope to include code snippets and tutorials inside articles.

Can anyone recommend a CI library or JQuery plugin that can highlight the code, possibly offering a plain text version.

I found many plugins for wordpress but no stand along options ?

Cheers
#2

[eluser]eoinmcg[/eluser]
Hi Opel,

I've experimented a bit with Chili, which is jQuery based.

Have a look here:

http://code.google.com/p/jquery-chili-js/
#3

[eluser]Dam1an[/eluser]
The most common library for this is GeSHi, there's also a CI plug-in
#4

[eluser]Evil Wizard[/eluser]
php already has a function built in to highlight source code files, see highlight_file()
#5

[eluser]n0xie[/eluser]
[quote author="Dam1an" date="1244653797"]The most common library for this is GeSHi, there's also a CI plug-in[/quote]
In case anyone is interested I rewrote parts of it to make it a library instead of a hook. I don't need it checking/loading GeSHi on every page load plus I like to be able to just 'drop it in' a project and just add codehighlighting for certain views.

It's pretty much hacked together so it's rather inefficient and crude, but if it works, don't fix it Wink
#6

[eluser]TheFuzzy0ne[/eluser]
If it ain't broke, fix it 'til it is. Big Grin
#7

[eluser]Phil Sturgeon[/eluser]
[quote author="Evil Wizard" date="1244657796"]php already has a function built in to highlight source code files, see highlight_file()[/quote]

Hmmm... font tags. My favourite.
#8

[eluser]Evil Wizard[/eluser]
oh crud I forgot how old that function was, hmmmmm not sure of an XHTML compliant alternative hehe
#9

[eluser]opel[/eluser]
Thanks I'll try that library




Theme © iAndrew 2016 - Forum software by © MyBB