Wednesday, November 12, 2008

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> -> 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 

1 comment:

  1. its broken! get an alert('cant find fsharp plugin'). This also happens on this very page!

    ReplyDelete