Nueglow is Nue’s built-in syntax highlighter. Where popular tools like Shiki and Prism ship grammar files, theme bundles, and megabytes of JavaScript, Nueglow takes a different approach: it parses code into a handful of semantic HTML elements and lets your CSS do the rest. The entire highlighter — covering every language — weighs under 3KB of CSS with no JavaScript runtime required in the browser.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/nuejs/nue/llms.txt
Use this file to discover all available pages before exploring further.
The problem with existing highlighters
Tools built for code editors carry assumptions that are expensive for websites.Massive footprint
Shiki ships 14MB across 44 packages. Each language requires its own grammar file with thousands of regex rules. HTML’s grammar alone runs over 2,000 lines.
Theme lock-in
Themes arrive as giant JSON files with 300+ hardcoded colors. Adapting them to your brand means overriding hundreds of color values, often fighting specificity wars.
Editor-first design
These tools were built for VS Code extensions, not websites. Your design system becomes an afterthought — something to work around rather than build on.
Nueglow was built specifically for the web. It assumes you already have a design system and wants to fit into it, not replace it.
Language-agnostic parsing
Rather than maintaining a per-language grammar file, Nueglow recognizes patterns that appear across virtually all programming languages:- Strings — single-quoted, double-quoted, and template literals
- Comments — line comments (
//,#,--) and block comments (/* */,<!-- -->,''',=begin) - Keywords — a shared vocabulary of ~50 common words covering 95% of real-world usage
- Operators and special characters — brackets, operators, punctuation
- Identifiers — function names, variable assignments, property names
None, nonlocal, and lambda to the keyword list; Go adds chan and fallthrough; C++ adds cout, cin, using, and namespace. Special-case rules for CSS (hex colors, !important, custom properties), JSON (key names), and YAML (mapping keys) complete the coverage.
This approach supports JavaScript, TypeScript, Python, HTML, CSS, YAML, JSON, Markdown, Bash, SQL, Go, Rust, Ruby, PHP, and more — without a single grammar file.
Semantic HTML output
Nueglow’s output is standard HTML using familiar inline elements. Each element carries meaning about the kind of token it wraps:| HTML element | Token type | Example |
|---|---|---|
<strong> | Keywords, HTML tag names, CSS hex colors | const, <div>, #ff0000 |
<em> | Strings, numeric values, CSS custom properties | "hello", 42, --color |
<sup> | Line and block comments | // note, /* block */ |
<b> | Identifiers — variable names, function calls, property access | myVar, fetch(, obj.key |
<i> | Operators, brackets, interpolation delimiters | {, =>, + |
<label> | Decorators, annotations, Markdown [section] labels | @media, !important |
<mark> | Highlighted spans (single • markers) | ••result•• |
<u> | Double-marked spans (double • markers) | ••••result•••• |
<ins> | Added lines (diff) | Lines prefixed with + |
<del> | Removed lines (diff) | Lines prefixed with - |
<dfn> | Focused lines | Lines prefixed with > |
<span> | Line number wrappers | When numbered: true |
Example: HTML output
Given this JavaScript input:<span> with an inline style attribute containing a hardcoded hex color — locking you to a specific theme and making brand customization nearly impossible.
Styling with CSS custom properties
Nueglow’s stylesheet uses CSS custom properties for every color, so overriding the entire color scheme means setting a handful of variables:Using Nueglow
Automatic: in Nuemark code blocks
When you write a fenced code block in a.md or .nue file, Nueglow runs automatically. Specify the language after the opening fence:
Standalone usage
You can call Nueglow directly from JavaScript when building custom tooling or rendering code outside Nuemark:glow function accepts a string of code and an options object:
| Option | Type | Default | Description |
|---|---|---|---|
language | string | auto-detected | Language hint for keyword lists and special rules |
numbered | boolean | false | Wrap each line in <span> for line number counters |
prefix | boolean | true | Interpret +, -, > line prefixes as diff markers |
mark | boolean | true | Process •• inline highlight markers |
Line markers
Nueglow supports diff-style line prefixes in code blocks:<ins>, <del>, and <dfn> elements, which Nueglow’s markers stylesheet styles with colored left borders and background tints.
Inline highlights
Wrap text with•• (two bullet characters, Alt+Q) to highlight a span within a line:
<mark> element around result, styled with a subtle background tint defined by --glow-marked-color.
Nueglow vs. Shiki and Prism
Nueglow
Under 3KB for all languages. Semantic HTML output. Zero JavaScript in the browser. Style with CSS custom properties you already control.
Shiki
14MB, 44 packages. One grammar file per language. Themes as JSON with 300+ hardcoded colors. Inline
style attributes make design system integration difficult.Prism
Smaller than Shiki but still grammar-per-language. Themes applied via class names. Customization requires theme forks and class overrides.
Styling line numbers
Enable line numbers by passingnumbered: true to the glow function, or by configuring it in your Nuemark settings. Each line is wrapped in a <span>, and CSS counters do the rest:
<pre> block automatically.