Fancy Code Tag For Java and C/C++

By firebrass Last update Oct 1, 2009 — Installed 98 times.

Script Summary: Adds syntax highlighting with line number and tab substitution to [code] tags on forums.

Version: 3

Copyright: Copyright(C)2009 Public Domain

This javascript adds syntax highlighting, line numbers, and replaces tab with spaces to the [code] tags found on forums. Its been tested on Opera 9 and Firefox on and

To Use: just copy and paste this code into the URL of the web browser like so:

  javascript:  {  copy and paste this script }  

Then you can bookmark this url and call on it as a bookmarklet, or use it with Opera or Greesemonkey

Note: You may need to supply the code tag signature for specific sites.

Languages: Java, JSP, and C/C++

v2: added CSS, regex for preprocessor directives (so tokenizer can be reused for c/c++)
v2.2: added C/C++ language
v3: added JSP and toolbar for selections.