Highlights the syntax in the text of 'code' tags according to a best-fit guess to determine language from 11 different languages.
This script will highlight syntax in a wide variety of languages. It will only operate on text in 'code' tags, and uses a 'best fit' guess to determine the language based on the number of syntax elements it matches. It will not attempt to highlight 'code' tags with the attribute class="no-highlight".
Only HTML and CSS are active by default, but changing the first executable line will allow you to highlight any combination of the following:
- python
- html
- css
- delphi
- perl
- php
- java
- cpp
- ruby
- javascript
- vbscript
The highlighting is done via CSS, which is placed for your convenience at the top of the script.
Test HTML can be found at http://pastebin.ca/399719 (and I apologize that I lack the ability to host the HTML file myself). Copy and paste it into notepad (or equivalent) and save it, then open with firefox. Again, sorry for the inconvenience.
I recieved the idea for this script from the thread http://userscripts.org/forums/2/topics/84 and the vast majority of the script, in all fairness, was written by Ivan Sagalaev and his collaborators (referred to in the thread). The original script is available at http://softwaremaniacs.org/soft/highlight/ under a BSD license. The two non-superficial additions in the grease monkey version of the script are calling the initialization function and adding the CSS directly (in the original, the CSS was in the test HTML, not in the script itself).
Change Log:
YYYY/MM/DD comment
2007/03/22 Fixed line wrapping error
2007/03/18 Initial script creation
Replace ImageShack images and links to a proxy server.As requested by wcgoh in this thread.
This user script is only useful if your server blocks imageshack.us.To select a proxy server, go to Tools -...
Redirect blogspot URLs to pkblogs.com.If blogspot is blocked in your country, you may need this.
Be patient when your browser's trying to visit the blocked blog, redirecting begins after that ...
Replace http://*.blogspot.com/* links with http://www.pkblogs.com/*/*If blogspot is blocked in your country, you may need this.
Not available in some online feed reader and forums, for the reason o...
Del.icio.us encrypted bookmarks creates bookmarks which are private even from del.icio.us by encrypting them using blowfish encryptionNote: If you want this script automatically updated, please instal...
Replaces Charter's irritating "search" page with something useful.Charter Communications, my ISP, has taken to intercepting failed page loads in a manner similar to what Internet Explor...
Display percentage statistics on user profileThis script is configurable. Edit the script with your favorit editor, and go to the line that says /* CONFIGURATION HERE */. The two variables below works...
Removes footer from Google homepage (google.com/ig)Removes footer from Google homepage (google.com/ig). This really is a very simple script, but someone requested that someone make it :)Google keeps c...
Removes all the ads, and the space they leave behind.Tired of all the annoying ads on MySpace? Need one simple script to remove them all? Then the Ad Slicer for MySpace is the solution you've bee...
Leave a comment