Syntax highlighting

Try Highlighter now!


If you click "codeblock" in the tag cloud to the right (unless you're reading this via The Complex), you'll get all the code blocks that I've posted to this blog. There aren't many, and they aren't exactly clever, but the more eagle-eyed among you will notice that they render much quicker than they did before. Although they still benefit from Alex Gorbatchev's wonderful syntax highlighter, they now render straight away with not even the slightest hint of JavaScript intervention and the only external dependency being a style sheet link.

Would you like to be able to post code highlighted with Alex's JavaScript library on your site with no page-end JavaScript dependency and no attendant rendering latency?

What you need is an online tool into which you can paste some C#, CSS, Pascal, Delphi, Java, PHP, JavaScript, Python, Ruby, SQL, VB, VB.Net, XML, HTML or (soon) C++ and then copy out the HTML for pasting to your page.
  1. // A C# syntax highlighting example  
  2.   
  3. /// <summary>  
  4. /// Add a rule to the list  
  5. /// </summary>  
  6. /// <param name="newRule">Rule to add</param>  
  7. public bool AddRule(string newRule)  
  8. {  
  9.     if (newRule.Contains(RuleOperator))  
  10.     {  
  11.         string[] operands = newRule.Split(RuleOperator.ToCharArray());  
  12.   
  13.         if (operands.GetLength(0) != 2)  
  14.             return false;  
  15.   
  16.         _prodRules[operands[0]] = operands[1];  // operands[0] is the LHS of the production rule    
  17.                                                 // and [1] is the RHS  
  18.         return true;  
  19.     }  
  20.   
  21.     return false;  
  22. }  


It'll be ready soon:) It's working offline, I just need to pretty it up and add C++ support.

Oh sod it, here's a beta.

Comments here or by email very much encouraged and appreciated.

Comments

Popular Posts