Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# Deps
node_modules
node_modules/

# Output
/.svelte-kit
/build
/dist
/dist_*
/target
/.gro
/.zzz
.svelte-kit/
build/
dist/
dist_*/
target/
.gro/
.fuz/
.zzz/

# Env
.env*
Expand Down
18 changes: 15 additions & 3 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ A modernized fork of PrismJS optimized for runtime syntax highlighting.

See [README.md](./README.md).

## Gro commands

```bash
gro check # typecheck, test, lint, format check (run before committing)
gro typecheck # typecheck only (faster iteration)
gro test # run tests with vitest
gro gen # regenerate .gen files
gro build # build the package for production
```

## Commands

```bash
Expand Down Expand Up @@ -48,8 +58,8 @@ The system uses regex-based tokenization inherited from PrismJS, maintaining com

#### Themes

- `src/lib/theme.css` - CSS classes for HTML mode (requires Fuz CSS or theme_variables.css)
- `src/lib/theme_variables.css` - CSS variable definitions for non-Fuz CSS users
- `src/lib/theme.css` - CSS classes for HTML mode (requires fuz_css or theme_variables.css)
- `src/lib/theme_variables.css` - CSS variable definitions for non-fuz_css users

## How It Works

Expand Down Expand Up @@ -142,10 +152,12 @@ An experimental alternative component (`CodeHighlight.svelte`) is available that
for browsers that implement it. This is not recommended for general use due to limited browser support.

**Components:**

- `src/lib/CodeHighlight.svelte` - Hybrid component supporting both HTML and range modes with auto-detection
- `src/lib/highlight_manager.ts` - Manages CSS Custom Highlights per element

**Theme:**

- `src/lib/theme_highlight.css` - CSS with both `.token_*` classes and `::highlight()` pseudo-elements

#### Range Highlighting Implementation
Expand Down Expand Up @@ -203,7 +215,7 @@ Results show relative performance (% of fastest) for each language and content s

## Color Variables

Theme uses CSS variables from Fuz CSS:
Theme uses CSS variables from fuz_css:

- `--color_a` - Keywords, tags
- `--color_b` - Strings, selectors
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ but there are two optional dependencies:
based on [`prism-svelte`](https://github.com/pngwn/prism-svelte)
and a [Svelte component](src/lib/Code.svelte) for convenient usage.
- The [default theme](src/lib/theme.css) integrates
with my CSS library [Fuz CSS](https://github.com/fuzdev/fuz_css) for colors that adapt to the user's runtime `color-scheme` preference.
Non-Fuz CSS users should import [theme_variables.css](src/lib/theme_variables.css)
with my CSS library [fuz_css](https://github.com/fuzdev/fuz_css) for colors that adapt to the user's runtime `color-scheme` preference.
Non-fuz_css users should import [theme_variables.css](src/lib/theme_variables.css)
or otherwise define those variables.

Compared to [Shiki](https://github.com/shikijs/shiki),
Expand Down Expand Up @@ -79,14 +79,14 @@ import '@fuzdev/fuz_code/theme.css';
```

The primary themes (currently just [one](src/lib/theme.css)) have a dependency
on my CSS library [Fuz CSS](https://github.com/fuzdev/fuz_css)
on my CSS library [fuz_css](https://github.com/fuzdev/fuz_css)
for [color-scheme](https://css.fuz.dev/docs/themes) awareness.
See the [Fuz CSS docs](https://css.fuz.dev/) for its usage.
See the [fuz_css docs](https://css.fuz.dev/) for its usage.

If you're not using Fuz CSS, import `theme_variables.css` alongside `theme.css`:
If you're not using fuz_css, import `theme_variables.css` alongside `theme.css`:

```ts
// Without Fuz CSS:
// Without fuz_css:
import '@fuzdev/fuz_code/theme.css';
import '@fuzdev/fuz_code/theme_variables.css';
```
Expand All @@ -96,9 +96,9 @@ import '@fuzdev/fuz_code/theme_variables.css';
- [@fuzdev/fuz_code/syntax_styler_global.js](src/lib/syntax_styler_global.ts) - pre-configured instance with all grammars
- [@fuzdev/fuz_code/syntax_styler.js](src/lib/syntax_styler.ts) - base class for custom grammars
- [@fuzdev/fuz_code/theme.css](src/lib/theme.css) -
default theme that depends on [Fuz CSS](https://github.com/fuzdev/fuz_css)
default theme that depends on [fuz_css](https://github.com/fuzdev/fuz_css)
- [@fuzdev/fuz_code/theme_variables.css](src/lib/theme_variables.css) -
CSS variables for non-Fuz CSS users
CSS variables for non-fuz_css users
- [@fuzdev/fuz_code/Code.svelte](src/lib/Code.svelte) -
Svelte component for syntax highlighting with HTML generation

Expand Down
122 changes: 88 additions & 34 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"node": ">=22.15"
},
"peerDependencies": {
"@fuzdev/fuz_css": ">=0.41.0",
"@fuzdev/fuz_css": ">=0.44.1",
"svelte": "^5"
},
"peerDependenciesMeta": {
Expand All @@ -45,16 +45,17 @@
},
"devDependencies": {
"@changesets/changelog-git": "^0.2.1",
"@fuzdev/fuz_css": "^0.43.0",
"@fuzdev/fuz_ui": "^0.177.0",
"@fuzdev/fuz_util": "^0.45.1",
"@fuzdev/fuz_css": "^0.44.1",
"@fuzdev/fuz_ui": "^0.178.2",
"@fuzdev/fuz_util": "^0.45.3",
"@ryanatkn/eslint-config": "^0.9.0",
"@ryanatkn/gro": "^0.184.0",
"@ryanatkn/gro": "^0.186.0",
"@sveltejs/adapter-static": "^3.0.10",
"@sveltejs/kit": "^2.49.1",
"@sveltejs/package": "^2.5.7",
"@sveltejs/vite-plugin-svelte": "^6.2.1",
"@types/node": "^24.10.1",
"@webref/css": "^8.2.0",
"eslint": "^9.39.1",
"eslint-plugin-svelte": "^3.13.1",
"esm-env": "^1.2.2",
Expand Down
Loading