Home >Web Front-end >JS Tutorial >How to use SyntaxHighlighter to implement HTML highlighting code_javascript skills

How to use SyntaxHighlighter to implement HTML highlighting code_javascript skills

WBOY
WBOYOriginal
2016-05-16 18:35:211201browse
http://www.jb51.net/jiaoben/15599.html
syntaxhighlighter is a small open source project that 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
Usage:
1. Assumptions The web page file test.htm is stored in a directory, then decompress dp.SyntaxHighlighter to a subdirectory under the directory, assuming it is images

2. Between the of the web page Insert the following code:
Copy the code The code is as follows:



3. Insert the following code on the web page where you want to display the program source code (where class="js" means displaying the source code in js syntax. Other settable class values ​​are
c#, css, c, delphi, java, js, php, python, ruby, sql, vb, xml) :
Copy code The code is as follows:




4. At the end of the web page Insert the following code before :
Copy the code The code is as follows:

< ;script class="javascript" src="images/Scripts/shCore.js">












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