Skip to content

CodeshineZero-dependency syntax highlighter

Beautiful, fast, and customizable code highlighting for the modern web

Codeshine

Quick Start

Install Codeshine via npm:

bash
npm install @oxog/codeshine

Use it in your project:

javascript
import { highlight } from '@oxog/codeshine'; const code = `function greet(name) {  console.log(\`Hello, \${name}!\`);}`; const html = highlight(code, {  language: 'javascript',  theme: 'github-dark',  lineNumbers: true,}); document.getElementById('code').innerHTML = html;

Features at a Glance

Line Highlighting

javascript
function processData(data) {  // This line is highlighted  const result = [];  for (const item of data) {  // These lines    result.push(transform(item)); // are also  }                               // highlighted  return result;}

Diff View

diff
- const oldValue = 'deprecated';+ const newValue = 'updated';  const unchanged = 'same';

Word Highlighting

Highlight specific words or patterns in your code for emphasis.

Copy Button

Every code block can have a copy button for easy code sharing.

Why Codeshine?

  • Performance: Optimized tokenizer with streaming support for large files
  • TypeScript: Full TypeScript support with strict types
  • Customizable: Create custom themes and languages easily
  • Modern: ES modules, tree-shakeable, and future-proof
  • Tested: 99%+ test coverage with comprehensive test suite

Released under the MIT License.