Repository navigation
Expand file tree
/
Copy pathcompare.html
More file actions
194 lines (191 loc) · 17.2 KB
/
Copy pathcompare.html
File metadata and controls
194 lines (191 loc) · 17.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Compare codelight.js</title>
<meta name="description" content="codelight.js, highlight.js, Prism and Shiki compared feature by feature, including where codelight.js is behind.">
<link rel="canonical" href="https://codelightjs.github.io/compare.html">
<meta property="og:type" content="website">
<meta property="og:site_name" content="codelight.js">
<meta property="og:title" content="codelight.js vs highlight.js, Prism and Shiki">
<meta property="og:description" content="Feature by feature, including where codelight.js is behind.">
<meta property="og:url" content="https://codelightjs.github.io/compare.html">
<meta property="og:image" content="https://codelightjs.github.io/og.png">
<meta name="twitter:card" content="summary_large_image">
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='7' fill='%2311141a'/%3E%3Cpath d='M9 11l-4 5 4 5M23 11l4 5-4 5' stroke='%23ff7aa8' stroke-width='2.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3Ccircle cx='16' cy='16' r='3.4' fill='%23ffb86b'/%3E%3C/svg%3E">
<link rel="stylesheet" href="site.css">
<style>
.table td small{display:block;color:var(--muted);font-weight:400;font-size:12.5px;margin-top:2px}
.table tr.cat td{background:var(--surface);color:var(--muted);font-size:12.5px;font-weight:600;text-transform:uppercase;letter-spacing:.05em;padding-top:8px;padding-bottom:8px}
.table th:nth-child(2){color:var(--accent)}
.table td:nth-child(2){background:color-mix(in srgb,var(--accent) 5%,transparent)}
.table tr.cat td:nth-child(2){background:var(--surface)}
.legend{display:flex;flex-wrap:wrap;gap:6px 18px;color:var(--muted);font-size:14px;margin-top:12px}
.else{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin-top:16px}
@media (max-width:760px){.else{grid-template-columns:minmax(0,1fr)}}
</style>
</head>
<body data-page="compare">
<!--HEADER:START (from partials/header.html by tools/build-demo.mjs)-->
<a class="skip" href="#main">Skip to content</a>
<header class="site-header">
<div class="wrap">
<a class="brand" href="./" aria-label="codelight.js home">
<svg width="30" height="30" viewBox="0 0 32 32" aria-hidden="true"><rect width="32" height="32" rx="7" fill="#11141a"/><path d="M9 11l-4 5 4 5M23 11l4 5-4 5" stroke="#ff7aa8" stroke-width="2.6" fill="none" stroke-linecap="round" stroke-linejoin="round"/><circle cx="16" cy="16" r="3.4" fill="#ffb86b"/></svg>
<span>codelight<b>.js</b></span>
<span class="version">v1.6.1</span>
</a>
<nav class="site-nav" id="site-nav" aria-label="Main">
<a href="./#use" data-page="start">Get started</a>
<a href="./#supported-languages" data-page="languages">Languages</a>
<a href="compare.html" data-page="compare">Compare</a>
<a href="benchmark.html" data-page="benchmark">Benchmark</a>
<a href="https://github.com/codelightjs/codelight.js/tree/main/docs">Docs</a>
<a href="about.html" data-page="about">About</a>
</nav>
<div class="header-actions">
<button class="icon-btn" id="theme" type="button" aria-label="Switch theme">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><circle cx="12" cy="12" r="9"/><path d="M12 3a9 9 0 0 1 0 18z" fill="currentColor"/></svg>
</button>
<a class="btn primary gh" href="https://github.com/codelightjs/codelight.js">
<svg viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38v-1.33c-2.23.48-2.7-1.07-2.7-1.07-.36-.92-.89-1.17-.89-1.17-.73-.5.06-.49.06-.49.8.06 1.23.83 1.23.83.72 1.22 1.87.87 2.33.66.07-.52.28-.87.5-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82a7.6 7.6 0 0 1 4 0c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48v2.2c0 .21.15.46.55.38A8 8 0 0 0 16 8c0-4.42-3.58-8-8-8z"/></svg>
<span>GitHub</span>
</a>
<button class="icon-btn menu-btn" id="menu" type="button" aria-label="Menu" aria-expanded="false" aria-controls="site-nav">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="M4 7h16M4 12h16M4 17h16"/></svg>
</button>
</div>
</div>
</header>
<!--HEADER:END-->
<main id="main" class="wrap">
<div class="page-hero">
<h1>Leads on <span>live code</span>. Honest about the rest.</h1>
<p>codelight.js, highlight.js, Prism and Shiki, feature by feature. Checked against each project's own docs on 30 Nov 2026.</p>
</div>
<section class="section">
<h2>Why pick codelight.js</h2>
<div class="cards">
<div class="card"><h3>No flicker on live code</h3><p>Finished lines are never redrawn, so code doesn't flash and text stays selectable while it changes.</p></div>
<div class="card"><h3>4.4× faster while streaming</h3><p>6 ms per update late in a 282-line file. highlight.js needs 24 ms, Shiki 190 ms. <a href="benchmark.html">See the benchmark</a>.</p></div>
<div class="card"><h3>Half-finished Markdown</h3><p><code>splitFences()</code> finds code blocks in an AI reply even before the fence closes. None of the others does this.</p></div>
<div class="card"><h3>50+ languages in 16 KB</h3><p>Everything in one file: languages, themes, line numbers, copy button. No dependencies, no WebAssembly.</p></div>
<div class="card"><h3>Extras built in</h3><p>Line numbers, highlighted lines, a copy button and a React component. Elsewhere these are plugins or other packages.</p></div>
<div class="card"><h3>Readable in light and dark</h3><p>One theme follows the system. Every colour has at least 4.5:1 contrast and is a CSS variable.</p></div>
</div>
</section>
<section class="section">
<h2>Feature by feature</h2>
<div class="legend"><span><span class="yes">✓</span> Built in</span><span><span class="part">◐</span> Add-on, third-party or partly</span><span><span class="no">✕</span> No</span></div>
<div class="table-wrap">
<table class="table">
<thead><tr><th>Feature</th><th>codelight.js</th><th>highlight.js</th><th>Prism</th><th>Shiki</th></tr></thead>
<tbody>
<tr class="cat"><td colspan="5">Live code</td></tr>
<tr><td>Highlights code as it arrives</td><td><span class="yes">✓</span> <small>mount(), write()</small></td><td><span class="no">✕</span></td><td><span class="no">✕</span></td><td><span class="part">◐</span> <small>@shikijs/stream</small></td></tr>
<tr><td>Finished lines never redrawn</td><td><span class="yes">✓</span></td><td><span class="no">✕</span></td><td><span class="no">✕</span></td><td><span class="part">◐</span> <small>With the stream add-on</small></td></tr>
<tr><td>Half-finished Markdown fences</td><td><span class="yes">✓</span> <small>splitFences()</small></td><td><span class="no">✕</span></td><td><span class="no">✕</span></td><td><span class="no">✕</span></td></tr>
<tr><td>Line numbers while code arrives</td><td><span class="yes">✓</span></td><td><span class="no">✕</span></td><td><span class="no">✕</span></td><td><span class="no">✕</span></td></tr>
<tr class="cat"><td colspan="5">Languages</td></tr>
<tr><td>Number of languages</td><td><span class="part">◐</span> <small>50+</small></td><td><span class="yes">✓</span> <small>190+</small></td><td><span class="yes">✓</span> <small>297</small></td><td><span class="yes">✓</span> <small>200+</small></td></tr>
<tr><td>Automatic language detection</td><td><span class="part">◐</span> <small>Add-on, 8.9 KB; plain text when unsure</small></td><td><span class="yes">✓</span></td><td><span class="no">✕</span></td><td><span class="no">✕</span></td></tr>
<tr><td>Code inside strings, languages inside languages</td><td><span class="yes">✓</span></td><td><span class="yes">✓</span></td><td><span class="yes">✓</span></td><td><span class="yes">✓</span></td></tr>
<tr><td>Add your own languages</td><td><span class="yes">✓</span> <small>registerLanguage()</small></td><td><span class="yes">✓</span></td><td><span class="yes">✓</span></td><td><span class="yes">✓</span> <small>TextMate grammars</small></td></tr>
<tr><td>Load only the languages you need</td><td><span class="no">✕</span> <small>All in one 16 KB file</small></td><td><span class="yes">✓</span></td><td><span class="part">◐</span> <small>Autoloader</small></td><td><span class="yes">✓</span></td></tr>
<tr class="cat"><td colspan="5">Display</td></tr>
<tr><td>Line numbers</td><td><span class="yes">✓</span></td><td><span class="no">✕</span></td><td><span class="part">◐</span> <small>Plugin</small></td><td><span class="part">◐</span> <small>Transformer</small></td></tr>
<tr><td>Highlight chosen lines</td><td><span class="yes">✓</span></td><td><span class="no">✕</span></td><td><span class="part">◐</span> <small>Plugin</small></td><td><span class="part">◐</span> <small>Transformer</small></td></tr>
<tr><td>Copy button</td><td><span class="yes">✓</span></td><td><span class="no">✕</span></td><td><span class="part">◐</span> <small>Plugin</small></td><td><span class="no">✕</span></td></tr>
<tr><td>Diff plus syntax colours</td><td><span class="no">✕</span> <small>Planned</small></td><td><span class="no">✕</span></td><td><span class="part">◐</span> <small>Plugin</small></td><td><span class="part">◐</span> <small>Transformer</small></td></tr>
<tr><td>Start numbering at a chosen line</td><td><span class="no">✕</span> <small>Planned</small></td><td><span class="no">✕</span></td><td><span class="part">◐</span> <small>Plugin</small></td><td><span class="part">◐</span> <small>Option</small></td></tr>
<tr class="cat"><td colspan="5">Themes</td></tr>
<tr><td>Built-in themes</td><td><span class="part">◐</span> <small>3</small></td><td><span class="yes">✓</span> <small>About 190</small></td><td><span class="yes">✓</span> <small>8, plus extras</small></td><td><span class="yes">✓</span> <small>60+</small></td></tr>
<tr><td>Light and dark from one setup</td><td><span class="yes">✓</span></td><td><span class="no">✕</span></td><td><span class="no">✕</span></td><td><span class="yes">✓</span></td></tr>
<tr><td>Colours checked for contrast</td><td><span class="yes">✓</span> <small>WCAG AA</small></td><td><span class="no">✕</span> <small>Not stated</small></td><td><span class="no">✕</span> <small>Not stated</small></td><td><span class="no">✕</span> <small>Not stated</small></td></tr>
<tr><td>Use VS Code themes</td><td><span class="no">✕</span></td><td><span class="no">✕</span></td><td><span class="no">✕</span></td><td><span class="yes">✓</span></td></tr>
<tr class="cat"><td colspan="5">Using it</td></tr>
<tr><td>Script tag from a CDN</td><td><span class="yes">✓</span></td><td><span class="yes">✓</span></td><td><span class="yes">✓</span></td><td><span class="part">◐</span> <small>ES modules only</small></td></tr>
<tr><td>Highlight every block on a page</td><td><span class="yes">✓</span> <small>highlightAll()</small></td><td><span class="yes">✓</span></td><td><span class="yes">✓</span></td><td><span class="no">✕</span></td></tr>
<tr><td>React component</td><td><span class="yes">✓</span> <small>With server rendering</small></td><td><span class="part">◐</span> <small>Third-party</small></td><td><span class="part">◐</span> <small>Third-party</small></td><td><span class="part">◐</span> <small>Streaming only</small></td></tr>
<tr><td>Vue or Svelte component</td><td><span class="no">✕</span> <small>Planned</small></td><td><span class="part">◐</span> <small>Vue plugin</small></td><td><span class="part">◐</span> <small>Third-party</small></td><td><span class="part">◐</span> <small>Streaming</small></td></tr>
<tr><td>markdown-it and rehype plugins</td><td><span class="no">✕</span> <small>Planned</small></td><td><span class="part">◐</span> <small>Third-party</small></td><td><span class="part">◐</span> <small>Third-party</small></td><td><span class="yes">✓</span></td></tr>
<tr><td>Plugin or hook API</td><td><span class="no">✕</span></td><td><span class="yes">✓</span></td><td><span class="yes">✓</span></td><td><span class="yes">✓</span></td></tr>
<tr class="cat"><td colspan="5">Project</td></tr>
<tr><td>No dependencies</td><td><span class="yes">✓</span></td><td><span class="yes">✓</span></td><td><span class="yes">✓</span></td><td><span class="no">✕</span></td></tr>
<tr><td>Actively developed</td><td><span class="yes">✓</span></td><td><span class="yes">✓</span></td><td><span class="part">◐</span> <small>v1 security fixes only</small></td><td><span class="yes">✓</span></td></tr>
<tr><td>Years in use</td><td><span class="no">✕</span> <small>New in 2026</small></td><td><span class="yes">✓</span> <small>Since 2006</small></td><td><span class="yes">✓</span> <small>Since 2012</small></td><td><span class="yes">✓</span> <small>Since 2018</small></td></tr>
</tbody>
</table>
</div>
<p class="note">"Add-on" means a plugin or package from the same project, or one someone else maintains. Counts for Shiki and highlight.js themes are approximate.</p>
</section>
<section class="section">
<h2>Use something else when</h2>
<div class="else">
<div class="card"><h3>You need a rare language</h3><p>highlight.js (190+) and Prism (297) cover far more than codelight.js's 50+. <a href="./#supported-languages">Check the list</a>.</p></div>
<div class="card"><h3>Exact VS Code colours matter most</h3><p>Shiki uses VS Code's own grammars and themes, so it's the most accurate.</p></div>
<div class="card"><h3>You need many themes or plugins</h3><p>highlight.js has about 190 themes; Prism has many official plugins.</p></div>
<div class="card"><h3>You want years of track record</h3><p>codelight.js is new. The others have been used for 8 to 20 years.</p></div>
</div>
<div class="cta-row">
<a class="btn primary" href="https://github.com/codelightjs/codelight.js/blob/main/docs/migrating.md">Switching from highlight.js or Prism</a>
<a class="btn" href="benchmark.html">See the benchmark</a>
</div>
</section>
</main>
<!--FOOTER:START (from partials/footer.html by tools/build-demo.mjs)-->
<footer class="site-footer">
<div class="wrap">
<div class="footer-grid">
<div class="footer-about">
<a class="brand" href="./">
<svg width="26" height="26" viewBox="0 0 32 32" aria-hidden="true"><rect width="32" height="32" rx="7" fill="#11141a"/><path d="M9 11l-4 5 4 5M23 11l4 5-4 5" stroke="#ff7aa8" stroke-width="2.6" fill="none" stroke-linecap="round" stroke-linejoin="round"/><circle cx="16" cy="16" r="3.4" fill="#ffb86b"/></svg>
<span>codelight<b>.js</b></span>
</a>
<p>Syntax highlighting that keeps up with live code. Very fast, lightweight, no dependencies.</p>
<code class="footer-install">npm i codelight.js</code>
</div>
<div>
<h2>Product</h2>
<ul>
<li><a href="./#try">Live demo</a></li>
<li><a href="./#use">Get started</a></li>
<li><a href="./#supported-languages">Languages</a></li>
<li><a href="compare.html">Compare</a></li>
<li><a href="benchmark.html">Benchmark</a></li>
</ul>
</div>
<div>
<h2>Docs</h2>
<ul>
<li><a href="https://github.com/codelightjs/codelight.js/blob/main/docs/getting-started.md">Getting started</a></li>
<li><a href="https://github.com/codelightjs/codelight.js/blob/main/docs/api.md">API</a></li>
<li><a href="https://github.com/codelightjs/codelight.js/blob/main/docs/streaming.md">Streaming</a></li>
<li><a href="https://github.com/codelightjs/codelight.js/blob/main/docs/react.md">React</a></li>
<li><a href="https://github.com/codelightjs/codelight.js/blob/main/docs/themes.md">Themes</a></li>
<li><a href="https://github.com/codelightjs/codelight.js/blob/main/docs/migrating.md">Switching from highlight.js</a></li>
</ul>
</div>
<div>
<h2>Project</h2>
<ul>
<li><a href="about.html">About</a></li>
<li><a href="https://github.com/codelightjs/codelight.js">GitHub</a></li>
<li><a href="https://www.npmjs.com/package/codelight.js">npm</a></li>
<li><a href="https://github.com/codelightjs/codelight.js/blob/main/CHANGES.md">Changelog</a></li>
<li><a href="https://github.com/codelightjs/codelight.js/issues">Report an issue</a></li>
<li><a href="https://github.com/codelightjs/codelight.js/blob/main/SECURITY.md">Security</a></li>
</ul>
</div>
</div>
<div class="footer-bottom">
<span>© 2026 <a href="https://github.com/ckgiri">CK Giri</a> · MIT licence</span>
<span>v1.6.1 · <a href="llms.txt">llms.txt</a></span>
</div>
</div>
</footer>
<!--FOOTER:END-->
<script src="site.js"></script>
</body>
</html>