Clone wiki

src-highlight-haskell / Home


This repository contains Haskell highlight rules for GNU Source-highlight. They can also be used to generate a JavaScript syntax highlighter for SHJS. So the same rules can be used to highlight syntax in the Haskell snippets on the web.

Rules' test.

How to use on the web

See JavaScript highlighter for Haskell code for details.

You need three files:

Source these files from the <head> of the HTML document:

<script type="text/javascript" src=""></script>
<script type="text/javascript" src=""></script>
<link type="text/css" rel="stylesheet" href="">

Add a callback to the <body> element:

<body onload="sh_highlightDocument();">

Put your Haskell snippets in <pre class="sh_haskell"></pre>, and they will be automatically highlighted when the page is loaded.

<pre class="sh_haskell">
-- Fibonacci numbers
fibs :: [Int]
fibs = 0 : 1 : zipWith (+) fibs (tail fibs)