Wiki

Clone wiki

src-highlight-haskell / Home

About

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="http://example.com/path/to/sh_main.min.js"></script>
<script type="text/javascript" src="http://example.com/path/to/sh_haskell.min.js"></script>
<link type="text/css" rel="stylesheet" href="http://example.com/path/to/stylesheet.css">

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)
</pre>

Updated