ARZENTIQ
DEVELOPER & DATA

Syntax Highlighter to HTML

Highlight code as HTML — JavaScript, TypeScript, CSS, JSON, Python, SQL, shell, HTML — as classed spans with a CSS block or inline styles; line numbers.

The highlighted HTML, escaped and ready to paste, the CSS for the classes (or inline styles), the detected language, and counts of tokens by kind.

Example: const x = 1; // one becomes <span class="hl-keyword">const</span> x <span class="hl-punct">=</span> <span class="hl-number">1</span>…; inline mode carries the colours in style attributes.

v0.1.0 · last reviewed 21 September 2026
Loading the workspace…
BUILT TO BE UNDERSTOOD

Spans, classes,
and nothing to load.

How code is tokenised, what the HTML looks like, and where the scanners stop.

Tokenising

JavaScript and TypeScript go through the site’s JS tokenizer (also used by the minifier and beautifier): strings, template literals, regular expression literals, comments, numbers, keywords and punctuation, with a word followed by ( marked as a function name. CSS, JSON, Python, SQL, shell and HTML have small purpose-built scanners for their strings, comments, numbers and keywords — CSS properties, HTML tags and attributes, SQL keywords case-insensitively. Detection looks for characteristic syntax (a tag at the start, def / import, SELECT … FROM, a shebang, property: value) and falls back to a generic scanner.

The HTML

Every token becomes <span class="hl-kind">text</span> with &, <, > and quotes escaped; plain tokens are left as bare text. A token spanning lines is split per line so line numbering and copy-paste stay clean. Classes mode adds a <style> block with a small default theme you can replace; inline mode writes the same colours as style attributes for e-mail and CMS fields that strip stylesheets. The wrapper is <pre class="hl"><code class="language-x">.

Limits

The scanners are lexers, not parsers: nested template literals in JS, heredocs in shell, CSS inside HTML, and languages not listed are coloured approximately or plainly. Colours are a fixed palette and not a claim of accessibility for your page — check contrast against your background. Nothing leaves the browser; the same four anonymous usage counts as the rest of the site apply.

SOURCES

  • Tokenisation by the site’s JavaScript tokenizer and small per-language scanners for strings, comments, numbers, keywords, tags and properties; HTML escaping of &, <, > and quotes

Last reviewed 21 September 2026. How results are checked: How we verify.