The syntax highlighter used by Code Hike.
See the codeThe syntax highlighter used by Code Hike.
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");
701 followers · starred Feb 2023
434 followers · starred Feb 2023
8,111 followers · starred Mar 2024
The syntax highlighter used by Code Hike.
See the codeThe syntax highlighter used by Code Hike.
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");
701 followers · starred Feb 2023
434 followers · starred Feb 2023
8,111 followers · starred Mar 2024