Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to embed codes on html pages

I'm on windows and I want to create a web-based code snippet tool for my own consumption. Because every awesome app seems to exist only on mac. Snippley is ok, but it doesn't have a search functionality. Is there a javascript library or a jquery plugin that allows me to present code snippets in a nice way? Something like the one in Nettuts: enter image description here

like image 245
Wern Ancheta Avatar asked Oct 10 '22 16:10

Wern Ancheta


1 Answers

The most beautiful and most used i guess is the Google code Prettify. It's a css library for doing exactly this screenshot you paste.

http://code.google.com/p/google-code-prettify/

you can use it with Twitter Bootstrap Css library too with Google Code Prettify: http://twitter.github.com/bootstrap/

Check the page source of Twitter Bootstrap and you gonna see that you need only something like this:

<link href="assets/js/google-code-prettify/prettify.css" rel="stylesheet">

Or you can choose between 16 free javascript code protiffiers here: http://www.1stwebdesigner.com/css/16-free-javascript-code-syntax-highlighters-for-better-programming/

and that's it!

like image 154
Pabluez Avatar answered Oct 14 '22 01:10

Pabluez