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

<asp:Label ID="Label1" runat="server" Text="Hello World"></asp:Label>
#include <stdio.h>

int main(int argc, char* argv[])
{
   printf("Hello, world!\n");
   return 0;
}
#include <iostream>
using namespace std;

int main()
{
    cout << "Hello, world!" << endl;
    return 0;
}
class HelloWorldApp
{
    static void Main()
    {
        System.Console.WriteLine("Hello, world!");
    }
}
<cfoutput>Hello, world!</cfoutput>
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";
<?php
 echo "Hello, world!";
?>
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 <?xml version="1.0" encoding="utf-8"?>
002 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
003 <html xmlns="http://www.w3.org/1999/xhtml">
004  <head>
005   <title>Hello, world!</title>
006  </head>
007  <body>
008   <p>Hello, world!</p>
009  </body>
010 </html>
.method public static void Main() cil managed
{
     .entrypoint
     .maxstack 1
     ldstr "Hello, world!"
     call void [mscorlib]System.Console::WriteLine(string)
     ret
}
 
 
 
Clicky Web Analytics