Click here to Skip to main content
12,394,971 members (54,719 online)
Click here to Skip to main content

Stats

248.7K views
6K downloads
171 bookmarked
Posted

Multiple Language Syntax Highlighting, Part 1: JScript

, 12 Mar 2003
Makes automaticaly highlighting source code in web page a reality (for C,C++,JScript, VBScript, XML)
highlight.png
parsecontext.png
pipe.png
schema.png
tn_schema.jpg
highlight.xsl
highlight.xsx
pipe.png
highlight.xsl
parsecontext.png
tn_schema.jpg
highlight.png
highlight.xsx
schema.png
<H2>Highlight code test suite:</H2>
<h3>Boxed and inlined code</h3>
<h4>C</h4>
Boxed code
<pre lang="c">/*this is c*/
char* sText;
sText="hello\" test\
       strings";
</pre>
and inlined code <code lang="c">char* str="string"; /*comment*/</code>.
<h4>C++</h4>
Boxed code
<pre lang="cpp">// this is c++
char* sText;
sText="hello\" test\
       strings";
</pre>
and inlined code <code lang="cpp">char* str="string"; //comment</code>.
<h4>Javascript</h4>
Boxed code
<pre lang="jscript">//this is jscript
var sText;
sText="hello\" test" + "another \
       string";
</pre>
and inlined code <code lang="jscript">var str="string"; // comment</code>.
<h4>VBScript</h4>
Boxed code
<pre lang="vbscript">' this is vbscript
Dim sText
sText="hello "" string" & test  & " test" 'playing with strings
</pre>
and inlined code <code lang="vbscript">Dim str="string" 'comment</code>.
<h4>XML</h4>
<pre lang="xml">
<?xml someparam="string" ?>
<elem attr1="text" attr2=string>
	a value.
</elem>
<empty-elem />
<ns:elem-with-namespace attr=test/>
<!-- Some comment -->
<elem-with-CDATA>
<![CDATA[A CDATA node]]>
</elem-with-CDATA>
</pre>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Jonathan de Halleux
Engineer
United States United States
Jonathan de Halleux is Civil Engineer in Applied Mathematics. He finished his PhD in 2004 in the rainy country of Belgium. After 2 years in the Common Language Runtime (i.e. .net), he is now working at Microsoft Research on Pex (http://research.microsoft.com/pex).

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.160721.1 | Last Updated 13 Mar 2003
Article Copyright 2003 by Jonathan de Halleux
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid