目前支持 Delphi、C#、C/C++, 以后我学到什么会让它支持什么; 欢迎你也使用.

使用方法:
首先在 HTML 的 <head> 和 </head> 之间加上:

然后:
<pre class=Delphi>Delphi 代码</pre> <pre class=cs>C# 代码</pre> <pre class=cpp>C 或 C++ 代码</pre>

样例:
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>代码着色测试</title> <script defer type="text/javascript" src="http://www.cnblogs.com/Files/del/del.js"></script> </head> <body> <pre class=Delphi> //Delphi 代码: program Project1; {$APPTYPE CONSOLE} uses SysUtils; begin try Writeln('Delphi 2009'); Readln; except on E:Exception do Writeln(E.Classname, ': ', E.Message); end; end. <hr> </pre> <pre class=cs> //C# 代码: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { Console.WriteLine("Visual C# 2008"); Console.ReadLine(); } } } <hr> </pre> <pre class=cpp> //C/C++ 代码: //--------------------------------------------------------------------------- #include <stdio.h> #pragma hdrstop #include <tchar.h> //--------------------------------------------------------------------------- #pragma argsused int _tmain(int argc, _TCHAR* argv[]) { printf("C++Builder 2009"); getchar(); return 0; } //--------------------------------------------------------------------------- <hr> </pre> </body> </html>

样例效果:
//Delphi 代码:
program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;

begin
  try
    Writeln('Delphi 2009');
    Readln;
  except
    on E:Exception do
      Writeln(E.Classname, ': ', E.Message);
  end;
end.
//C# 代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Visual C# 2008");
            Console.ReadLine();
        }
    }
}
//C/C++ 代码:
//---------------------------------------------------------------------------

#include 
#pragma hdrstop

#include 
//---------------------------------------------------------------------------

#pragma argsused
int _tmain(int argc, _TCHAR* argv[])
{
    printf("C++Builder 2009");
    getchar();
    return 0;
}
//---------------------------------------------------------------------------

posted on 2008-12-29 11:27  万一  阅读(2531)  评论(7编辑  收藏