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

This repository contains a highlight.js plugin for CFML, the language of Adobe ColdFusion and Lucee.
Installation
To install the package, run:
npm install @exercism/highlightjs-cfmlThen register the language under the name cfml:
import hljs from "highlight.js";
import hljsDefineCfml from "@exercism/highlightjs-cfml";
hljs.registerLanguage("cfml", hljsDefineCfml);The grammar handles both CFML syntaxes.
If the code starts with a tag (after any <!--- ---> comments), the grammar reads it as tag syntax, as in a .cfm page.
Otherwise it reads it as script syntax, as in a component { } file.
The grammar uses no regex lookbehind, so it loads in every browser that highlight.js supports.
Tests
To run the tests, run:
bun testEach file in test/markup is some CFML code, and the .expected file next to it is the HTML that highlight.js should produce from it.
The solution-* files come from the Exercism CFML track.
To check the grammar against every example solution in a checkout of the CFML track, run:
bun bin/render-solutions path/to/cfml path/to/output-dirIt lists the words given each highlight.js scope, so a word with the wrong colour stands out, and writes each solution's HTML to the output directory.
To render every CFML file in the track, add the glob "exercises/**/*.{cfc,cfm}" after the output directory.
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 CFML code.
Credits
The grammar was originally forked from src/cfml-highlightjs.ts in websolete/markdown-cfml-syntax, written by Kevin Miller and released under the MIT License.
Its copyright notice is kept in LICENSE.
The tag syntax follows the vscode-cfml TextMate grammar by KamasamaK.
