Syntaxhighlighter code Add color use method _javascript skill
Source: Internet
Author: User
It can highlight various program source code syntax in a Web page. Supports the various programming languages that are currently popular: C #, CSS, C + +, Delphi, Java, JavaScript, PHP, Python, Ruby, SQL, Visual Basic, xml/html
Download Address: http://www.dreamprojections.com/syntaxhighlighter/
or http://code.google.com/p/syntaxhighlighter/
Demo Address: http://www.dreamprojections.com/syntaxhighlighter/Tests/PHP.html
The tool core is based on JavaScript and is simple to use:
1, assume that the Web page file test.htm stored in a directory, will dp.syntaxhighlighter uncompressed, and copy the Scripts folder and styles folder, ensure and test.html under the same directory.
2, insert the following code between the <link type= "Text/css" rel= "stylesheet" href= "Styles/syntaxhighlighter.css" ></link>
3, in the page to display the source code of the program to insert the following code, if HTML type, with XML (other such as class= "JS" to show the source code JS syntax, other can be set the class value of C #, CSS, C, Elphi, Java, JS, PHP, Python, Ruby, SQL, VB, xml:
<textarea name= "code" class= "JS" rows= "cols=" >
The program source code is here.
</textarea>
Description
Name= "code" is necessary and cannot be changed;
Class= "XML" is a way of coloring, that is, the type of code that needs to be shaded and changed as needed.
4. Insert the following code before </body> at the end of the page:
A page can contain any number of code segments that need to be shaded;
There are all kinds of coloring cases in the package that you can use for reference.
Method Two:
1. First add the following code on the page (assuming the downloaded syntaxhighlighter is placed under the Syntaxhighlighter directory, note the directory structure):
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.