Syntax highlighting
Since there are good chances that I post code samples in the blog, I wanted a good way to format them and I think I found one. There’s a WordPress plug-in which uses this Syntax Highlighter written in JavaScript (the Highlight occurs client-side).
For my personal use, a good syntax highlighter should :
- be easy to use, I don’t want to have to make lots of manipulations to output a well formatted code,
- allow easy editing : if my code is escaped with lots of HTML tags and CSS, it won’t be very convenient to work with while editing a post,
- allow visitor to copy paste it, without having the same kind of HTML tags disturbance,
- support a least C# and XML,
- output formatted code in RSS.
Let see how this plug-in render :
// Hello1.cs
public class Hello1
{
public static void Main()
{
System.Console.WriteLine("Hello, World!");
}
}
Not too bad. Let’s see with a XML document now :
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section
name="castle"
type="Castle.Windsor.Configuration.AppDomain.CastleSectionHandler, Castle.Windsor" />
</configSections>
<castle>
<components>
</components>
</castle>
</configuration>
Fine !
I just see one problem with that solution : since Syntax Highlight is processed client side (JavaScript), the code will not be highlighted in RSS :-(
I found an other solutions that can do the job : http://www.manoli.net/csharpformat/format.aspx is an online service that can encode source code snippets in HTML. The annoying point with that is that it generates quite a lot of CSS/HTML and I fear the day where I will have to update some piece of code surrounded with 5465451 HTML tags…
Applying UML and Patterns: An Introduction to Object-Oriented Analysis and Design and Iterative Deve
Code Complete: A Practical Handbook of Software Construction
Refactoring: Improving the Design of Existing Code
The Pragmatic Programmer: From Journeyman to Master
Peopleware: Productive Projects and Teams
Domain-Driven Design: Tackling Complexity in the Heart of Software
Agile Principles, Patterns, and Practices in C#
Threading in C#
Applying Domain-Driven Design and Patterns: With Examples in C# and .NET
Object-Oriented Software Construction
Test Driven Development: By Example
Design Patterns: Elements of Reusable Object-Oriented Software
как раз в тему!!!!)))))))))))))))))))))))))))))))))…
For my personal use, a good syntax highlighter should :
be easy to use, […….