Source code highlighting

    I rewrote and changed (especially for Habra, and more precisely for the .NET blog) at my leisure a small module that highlights the source code of C #, VB.NET, HTML / XML / ASPX, JavaScript and SQL.

    If you want to insert a piece of source code into a new post or comment on a post, use Source Code Highlighter to highlight your code.

    There is support for line numbering and line wrapping inserts if you checked "Disable autoformatting" when writing a post.

    Here is an example of the highlighted source code that this module issues :

    1. using System;
    2. using System.Data;
    3. using System.Configuration;
    4. using System.Web;
    5. using System.Web.Security;
    6. using System.Web.UI;
    7. using System.Web.UI.WebControls;
    8. using System.Web.UI.WebControls.WebParts;
    9. using System.Web.UI.HtmlControls;
    10.  
    11. ///
    12. /// Summary description for Test
    13. ///
    14. public class Test
    15. {
    16.  
    17.   private int m_TestVar1;
    18.   private float m_TestVar2;
    19.   private DateTime m_TestVar3;
    20.  
    21.   public Test ()
    22.   {
    23.     //
    24.     // TODO: Add constructor logic here
    25.     //
    26.   }
    27.  
    28.   public int TestVar1
    29.   {
    30.     get {return m_TestVar1; }
    31.     set {m_TestVar1 = value; }
    32.   }
    33.  
    34.   public float TestVar2
    35.   {
    36.     get {return m_TestVar2; }
    37.     set {m_TestVar2 = value; }
    38.   }
    39.  
    40.   public DateTime TestVar3
    41.   {
    42.     get {return m_TestVar3; }
    43.     set {m_TestVar3 = value; }
    44.   }
    45.  
    46. }
    * This source code was highlighted with Source Code Highlighter .


    Bugs, requests and wishes leave in the comments. :)

    I hope that this module will be useful for many and not only for use on this blog.
    Use for health!

    PS The
    link to the site will always hang in the description of the blog.

    UPD # 1: Added the ability to highlight HTML / XML / ASPX code.
    UPD # 2: Added the ability to quickly copy code to the clipboard.
    UPD # 3: Fixed line numbering. Now you can copy the code to the clipboard without any problems.

    Also popular now: