@exercism/highlightjs-purescript
v1.0.1
Published
PureScript language support for Highlight.js
Readme
highlightjs-purescript ·

This repository contains a highlightjs plugin for the PureScript language.
It covers PureScript's keywords (including ado, derive, forall/∀ and foreign import), declarations, """ raw strings, string gaps, character literals, numbers, nested block comments, and the labels in records, record types and record updates.
It uses no regex lookbehind, so it works in every browser.
Installation
To install the package, run:
npm install @exercism/highlightjs-purescriptThen register it with highlight.js:
import hljs from "highlight.js";
import setupPureScript from "@exercism/highlightjs-purescript";
hljs.registerLanguage("purescript", setupPureScript);Publish on NPM
To publish the package, run:
bun publishLocal development
First, install the dependencies:
bun installThen run:
bun devThis will start a Vite dev server that shows some highlighted PureScript code.
Tests
To run the tests, run:
bun testEach test/markup/*.txt file is highlighted and compared with its .expected file.
Some of them are example solutions from the PureScript track.
Credits
The grammar was originally forked from the Haskell grammar in highlight.js. That grammar was written by Jeremy Hull, with contributions from Zena Treep, and is licensed under the BSD 3-Clause License (Copyright (c) 2006, Ivan Sagalaev). Its licence notice is kept in LICENSE.
The PureScript syntax comes from the PureScript language reference and the language-purescript TextMate grammar.
