Syntax Highlighter

A simple syntax highlighter for BlogEngine.net using syntax highlighting by Wilco Bauwer

Licensed under Ms-PL

Download: SyntaxHighlightingExtension.zip (97,09 kb - v0.1.1 - 15.Aug.2007) Demo

Additional Infos in source file and readme.txt

Ali Ozgur made some improvement to the highlighter when using with html code. (From WYSIWYG editors, or even self written)

 

Changelog

Current Version: 0.1.1
Released on: 15. August 2007

  • 0.1.1 Added Line numbers
    To use line numbering use the ln=on setting in the code tag.
  • 0.1 Initial release

Installation

  • copy Wilco.SyntaxHighlighter.dll into Bin
  • copy SyntaxHighlightingExtension.cs into App_Code/Extensions
  • copy SyntaxHighlightTemplate.txt to App_Data/furred
    the directory ‘furred’ will be used by further extensions provided by me
  • use it! :)

Additional steps for default style:

  • for the default template copy page_white_code.png into /pics and adjust image url!
  • add the CSS code from DefaultStyle.css to your css file

Usage examples

[ code=csharp] your code! [/code]
[ code=csharp;ln=on;title] bla bla [/code] [ code=csharp;A optional title!] your code! [/code]
[ code=anyOtherSupportedLanguage] your code! [/code]

  (Without spaces!)

Demo

  Snippets by wikibooks.org - List of hello world programs

#include   int main(int argc, char* argv[]) {    printf("Hello, world!\n");    return 0; }
#include  using namespace std;  int main() {     cout << "Hello, world!" << endl;     return 0; }
class HelloWorldApp {     static void Main()     {         System.Console.WriteLine("Hello, world!");     } }
IDENTIFICATION DIVISION. PROGRAM ID.  HELLO-WORLD. PROCEDURE DIVISION.     DISPLAY "Hello, world!"     STOP RUN.
class HELLO_WORLD  create make feature     make is     do         io.put_string("Hello, world!%N")     end -- make end -- class HELLO_WORLD
   PROGRAM HELLO      PRINT *, 'Hello, world!'    END
main = putStrLn "Hello, world!"
public class HelloWorld {      public static void main(String[] args)       {           System.out.println("Hello, world!");      } }
document.writeln('Hello, world!');
program hello; begin     writeln('Hello, world!'); end.
print "Hello, world!\n";
print "Hello, world!"
puts "Hello, world!"
CREATE TABLE message (text char(15)); INSERT INTO message (text) VALUES ('Hello, world!'); SELECT text FROM message; DROP TABLE message;
WScript.Echo "Hello, world!"
001            Hello, world!
002<p>Hello, world!</p>
003
.method public static void Main() cil managed {      .entrypoint      .maxstack 1      ldstr "Hello, world!"      call void [mscorlib]System.Console::WriteLine(string)      ret }