Syntax highlighting
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.
- // A C# syntax highlighting example
- /// <summary>
- /// Add a rule to the list
- /// </summary>
- /// <param name="newRule">Rule to add</param>
- public bool AddRule(string newRule)
- {
- if (newRule.Contains(RuleOperator))
- {
- string[] operands = newRule.Split(RuleOperator.ToCharArray());
- if (operands.GetLength(0) != 2)
- return false;
- _prodRules[operands[0]] = operands[1]; // operands[0] is the LHS of the production rule
- // and [1] is the RHS
- return true;
- }
- return false;
- }
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