syntax hightlight made easy

Usage no npm install needed!

<script type="module">
  import sublemon from '';




Build Status

Another syntax highlighter that support mixed language content by default.


with webpack, you can require this module and get

var sublemon = require('sublemon');

var html = sublemon('your code here');

// client side render
document.body.innerHTML = html;

for simpler browser side usage, you can just load dist/sublemon.min.js and theme.css in your browser and


this will automagically highlight all code in an element with class name sublemon

why use sublemon ?

  • if you want to highlight mixed language content
  • if you have create your own programming language and have a hard time make other highlight library work for your language
  • you try to highlight your css4 code but found that your highlight library only support css3

when not to use sublemon: If you know you only want to highlight java code, then you want to use more robust solutions like syntax highlight or highlight.js.


Since sublemon is a very generic highlighter, things will not look perfect.
You can take a look at screen shots in screenshot directory to decide if you want to use this library. sublemon


npm install --save sublemon


Microlight : highlights code in any programming language.
This is where I get idea for this project. It's great if you want to have a small foot print.
But I want more an isomorphic solution that can be styled via css.

Acorn : A small, fast, JavaScript-based JavaScript parser.
This is where I get inspiration for my parser.