New F# SyntaxHighlighter Brush

Ever since my previous blog about Code Highlighters For Your Blog, I have heard several people interested in implementing the SyntaxHighlighter on their blog. If so, there is a good article by Guogang Hu about integrating it into your Blogger blog.

One of those individuals was my friend, Daniel Mohl (via twitter... @dmohl). However, Daniel had a need to support F#, which is not one of the out-of-the-box languages that is supported by the SyntaxHighlighter. I saw this as a fun side project to support this language for him.

F.Y.I. If you like F#, his blog is definitely one you should check out!

Here is an example F# program that is only a proof of concept that Dan put together for me to exercise the F# brush sufficiently... it doesn't actually work! :) I am just starting to learn the language, so please give me some slack!

If you find any areas that I missed while supporting the language, please let me know and I'll fix it. Feel free to download and use the F# SyntaxHighlighter Brush and provide any suggestions or comments.

Note: The JavaScript file has been minimized with JSMin, so it might be a little difficult to read.

I'd like to contribute the F# Brush to the Google Code project, but I am not yet a contributor on the project. If I am able to become a contributor, then I will post the code as part of the main project.

#light
namespace testforElijah
module testModuleForElijah
open System
let multiple x = x * x
val CalculateSeqExample: seq -> int
type ICustomerDao = interface
abstract GetById: int -> ICustomer
end
type CustomerDao = class
new: unit -> CustomerDao
interface ICustomerDao
end
if
then
elif
else
@"c:\test\test.xml"
'c'
"xyz"B
"tes"+"t"
[for x in list -> expr]
type 'a option =
| None
| Some of 'a

//This is a test
let showSomething (name, something)
match name with
| Some (some, thing) -> (* do something*)
| None

type node =
{ Name : string;
Links : list list;}
and link =
| Dangling
| Link of node
</pre>

If you enjoyed this post, please consider sharing it with others via the following Twitter or Reddit buttons. Also, feel free to checkout my egghead.io profile page for addition free and subscription lessons, collections, and courses. As always, you can reach out to me on Twitter at @elijahmanor. Thanks and have a blessed day!

Reddit