TypeScript Syntax Highlighting for WordPress
Posted
For my first post on TypeScript, I included many code samples, and found the Javascript highlighting to be lacking since TypeScript introduces a number of new keywords. To remedy, I've put together a simple plugin that adds a TypeScript brush to the SyntaxHighlighter Evolved plugin, using this excellent tutorial. Once installed, you can use the new tags to highlight your TypeScript code, either [ts][/ts]
or [typescript][/typescript]
.
Download the "SyntaxHighlighter Evolved: TypeScript Brush" plugin
Here is an example:
declare var jQuery: any;
module Sayings {
export class Greeter
extends BaseGreeter
implements IGreeter
{
private greeting: string;
constructor(message: string) {
this.greeting = message;
}
public greet() {
var s = 'Hello, ' + this.greeting;
return s;
}
}
}