Lighter
The syntax highlighter used by Code Hike.
Install / Use
/learn @code-hike/LighterREADME
The syntax highlighter used by Code Hike.
Usage
import { highlight } from "@code-hike/lighter";
const { lines, style } = await highlight(
/* code */ "print('hello')",
/* lang */ "py",
/* theme */ "github-dark"
);
// base foreground and background
const { color, background } = style;
console.log(lines);
Output:
[
[
{ "style": { "color": "#79C0FF" }, "content": "print" },
{ "style": { "color": "#C9D1D9" }, "content": "(" },
{ "style": { "color": "#A5D6FF" }, "content": "'hello'" },
{ "style": { "color": "#C9D1D9" }, "content": ")" }
]
]
For dark/light theme support with CSS see #25
For more theme colors (like line number foreground, selection background, etc.):
import { getThemeColors } from "@code-hike/lighter";
const themeColors = await getThemeColors("material-darker");
Credits
- Using vscode-oniguruma for highlighting
- Heavily inspired by Shiki and adapted to Code Hike needs.
- Some more inspiration from starry-night
- Grammars and some themes come from Shiki, which pulls them from different sources.
Related Skills
node-connect
345.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
104.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
345.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
345.4kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
