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

This repository contains a highlightjs plugin for the Idris 2 language.
It covers Idris 2's keywords (including interface, implementation, public export, total, mutual and namespace), % directives such as %default total, ?holes, ||| doc comments, nested {- -} comments, names in dependent binders such as (n : Nat) and {auto prf : NonEmpty xs}, \{} string interpolation, raw #"..."# strings, """ multiline strings, character literals and numbers.
It uses no regex lookbehind, so it works in every browser.
Installation
To install the package, run:
npm install @exercism/highlightjs-idrisThen register it with highlight.js:
import hljs from "highlight.js";
import setupIdris from "@exercism/highlightjs-idris";
hljs.registerLanguage("idris", setupIdris);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 Idris 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 Idris track.
Credits
This grammar was originally forked from the Haskell grammar in highlight.js, written by Jeremy Hull with contributions from Zena Treep.
highlight.js is copyright (c) 2006 Ivan Sagalaev and is licensed under the BSD 3-Clause License.
The LICENSE file includes its notice.
The Idris 2 syntax comes from the Idris 2 documentation, the Idris 2 lexer (src/Parser/Lexer/Source.idr) and the Pygments Idris lexer.
