Yesterday, I finally got around to publishing my OPL support for highlight.js. I’ve been using it here since I wrote it a couple of months ago, but now it’s available on GitHub and NPM for others to use.

PROC hello:
  PRINT "OPL is amazing!"
  GET
ENDP

Just like highlight.js itself, it’s incredibly easy to use, and there are a few different options.

You can use the module directly (what I do on this website):

import hljs from '../highlight.js/es/highlight.js';
import opl from './highlightjs-opl/src/languages/opl.js';
hljs.registerLanguage('opl', opl);
hljs.highlightAll();

Or add the minified self-registering version from the UNPKG CDN to your site’s head (how I’m using it on the OpoLua website):

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/styles/default.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/highlight.min.js"></script>
<script type="text/javascript" src="https://unpkg.com/highlightjs-opl/dist/opl.min.js"></script>
<script type="text/javascript">
    hljs.highlightAll();
</script>

I’m looking forward to seeing all your OPL projects!