Yesterday, I went to the PHP enthusiast website and saw a good calendar code. I thought it had a good learning value and I went to my website. However, I found that the highlight of my code is not as nice as it is. I have been using Google-syntax-highlighter 1.5.1. Released on August 5, 2007. Is a tool released in. When the class is Php, the Code display is not so intelligent, such as keywords and data structures. The highlighting method is not ideal.
Now I use the latest syntaxhighlighter_2.1.364. The following is the version history:
- 1.5. Released on May 11,200 7.
- 1.5.1. Released on August 5, 2007.
- 2.0. Released on February 3, 2009. aristocratic entertainment city
Syntaxhighlighter is a powerful code highlighting tool written in Javascript. It can highlight various program source code syntaxes on the webpage. The latest version is 2.0.296. Currently, the supported programming languages are: bash/shell, C #, C ++, CSS, Delphi, diff, groovy, JavaScript, Java, Perl, PHP, plain text, Python, Ruby, Scala, SQL, Visual Basic, XML/XHTML/XSLT/html.
You can see its JS file organization.
- Shbrushbash. js
- Shbrushcpp. js
- Shbrushcsharp. js
- Shbrushcss. js
- Shbrushdelphi. js
- Shbrushdiff. js
- Shbrushgroovy. js
- Shbrushjava. js
- Shbrushjscript. js
- Shbrushphp. js
- Shbrushzain. js
- Shbrushpython. js
- Shbrushruby. js
- Shbrushscala. js
- Shbrushsql. js
- Shbrushvb. js
- Shbrushxml. js
The new syntaxhighlighter version adds support for several new languages, such as groovy and Scala. If you are interested in learning these new languages, you still need to update this tool.
Upload, you can load different style files according to your favorite style.
Among the 19 JS files loaded by the above Code, except the first shcore. in addition to JS, each JS file corresponds to a programming language (depending on the file name, you can determine which programming language is supported), and you can choose whether to load as needed.
Place the source code to be highlighted between <PRE> </PRE>. For example:
2 |
echo "Hello, Welcome to NowaMagic!" ; |
Google's code highlighting tool syntaxhighlighter