@exercism/highlightjs-yamlscript
v1.0.1
Published
YAMLScript language support for Highlight.js
Maintainers
Keywords
Readme
highlightjs-yamlscript

This repository contains a highlight.js plugin for the YAMLScript language.
It registers as yamlscript, with the alias ys.
The grammar follows YAMLScript's two modes.
In code mode, it highlights definitions, calls, colon and dot chains, strings with interpolation, regexes, characters and keywords.
After :: (or =::), it switches to data mode and highlights the YAML keys, quoted strings, numbers and literals, leaving plain text alone.
It uses no regex lookbehind, so it can be imported statically.
Installation
To install the package, run:
npm install @exercism/highlightjs-yamlscriptThen register it:
import hljs from "highlight.js";
import yamlscript from "@exercism/highlightjs-yamlscript";
hljs.registerLanguage("yamlscript", yamlscript);Publish on NPM
To publish the package, run:
bun publishLocal development
First, install the dependencies:
bun installTo run the tests, run:
bun testThe tests compare the output for each file in test/markup/ with its .expected file.
After changing the grammar, regenerate an expected file with bun bin/render.ts test/markup/<name>.txt > test/markup/<name>.expected, and check the difference by eye before committing it.
To check every example solution in a local checkout of exercism/yamlscript, run:
bun bin/render-examples.ts ../yamlscript /tmp/yamlscript-renderThis writes examples.html and a compact examples.txt view ([scope|text]) to the output folder.
Set ALL=1 to include the test files.
To see the highlighting in a browser, run:
bun devThis will start a Vite dev server with some highlighted YAMLScript code.
