Home  >  Article  >  Web Front-end  >  How to use SyntaxHighlighter code to add color_javascript skills

How to use SyntaxHighlighter code to add color_javascript skills

WBOY
WBOYOriginal
2016-05-16 19:01:15967browse

It can highlight various program source code syntax in web pages. Supports various currently popular programming languages: 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 core of this tool is based on javascript, and it is very simple to use:


1. Assume that the web page file test.htm is stored in a directory, unzip dp.SyntaxHighlighter, and copy the Scripts folder therein and styles folder, make sure it is in the same directory as test.html.

2. Insert the following code between

on the web page:


3. Insert it where the program source code is to be displayed on the web page If the following code is of HTML type, use XML (others such as class="js" indicate that the source code is displayed in js syntax. Other settable class values ​​are c#, css, c, elphi, java, js, php, python, ruby, sql, vb, xml):



Instructions:
name="code " is required and cannot be changed;
class="xml" is the coloring method, that is, the type of code that needs to be colored, which can be changed as needed.

4. Insert the following code before
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn