Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
d5c30f7
code
arthurfiorette Jan 16, 2026
a65c61c
code
arthurfiorette Jan 21, 2026
79be573
code
arthurfiorette Jan 21, 2026
f666fe1
Fix tsserver protocol parser for TypeScript 5.9.3 (#455)
Copilot Jan 22, 2026
2aa14b4
code
arthurfiorette Jan 22, 2026
faacfcc
code
arthurfiorette Jan 22, 2026
86301e4
code
arthurfiorette Jan 22, 2026
62bdc63
code
arthurfiorette Jan 22, 2026
e426662
benchmarks
arthurfiorette Jan 22, 2026
4611a6e
instructions
arthurfiorette Jan 22, 2026
60d5b94
code
arthurfiorette Jan 22, 2026
d4dd824
code
arthurfiorette Jan 22, 2026
3a287d5
code
arthurfiorette Jan 22, 2026
da70177
code
arthurfiorette Jan 23, 2026
5cca6a7
code
arthurfiorette Jan 24, 2026
2a32081
code
arthurfiorette Jan 24, 2026
2b37245
code
arthurfiorette Jan 24, 2026
e76625c
docs
arthurfiorette Jan 24, 2026
82e180a
correctly set licence to MIT
arthurfiorette Jan 25, 2026
2d4ca0e
readme examples
arthurfiorette Jan 25, 2026
ee567f8
bin fixes
arthurfiorette Jan 25, 2026
931bba1
turbo actions cache
arthurfiorette Jan 25, 2026
b6d2ec0
Improve the fastify plugin
arthurfiorette Feb 4, 2026
5bcb094
improve examples
arthurfiorette Feb 4, 2026
543ab35
rspress template
arthurfiorette Feb 7, 2026
1e0cc06
more templates
arthurfiorette Feb 13, 2026
3b490dd
new docs
arthurfiorette Feb 13, 2026
540fca0
Improve documentation
arthurfiorette Feb 13, 2026
3abb564
Ignore docs from changesets
arthurfiorette Feb 13, 2026
7e87a47
code
arthurfiorette Feb 13, 2026
0503b80
Rename to Kita Html
arthurfiorette Feb 16, 2026
baa9d90
improve docs
arthurfiorette Feb 21, 2026
cfc8c33
Merge remote-tracking branch 'origin/master' into arthurfiorette/serena
arthurfiorette Feb 21, 2026
b14d548
fix ci
arthurfiorette Feb 21, 2026
e4b29d6
fix ci workflows
arthurfiorette Feb 21, 2026
847efe7
Update docs
arthurfiorette Feb 21, 2026
c3841b3
test only node 24
arthurfiorette Feb 21, 2026
930332e
code
arthurfiorette Feb 21, 2026
5dc44e4
code
arthurfiorette Feb 23, 2026
26c5f8e
code
arthurfiorette Feb 23, 2026
668ef74
Use next branch
arthurfiorette Feb 23, 2026
7816495
fix lts/*
arthurfiorette Feb 23, 2026
fd1979c
code
arthurfiorette Feb 23, 2026
e4b9754
Test types CI
arthurfiorette Feb 23, 2026
ed705a4
concurrency
arthurfiorette Feb 23, 2026
7d43f1b
Fix test-types
arthurfiorette Feb 23, 2026
da3635d
Fix actions
arthurfiorette Feb 23, 2026
77b337b
Improvements
arthurfiorette Feb 23, 2026
0723464
code
arthurfiorette Feb 23, 2026
25e560f
code
arthurfiorette Feb 23, 2026
c9fb6b1
code
arthurfiorette Feb 23, 2026
d898b4e
docs
arthurfiorette Feb 24, 2026
8bd6725
code
arthurfiorette Feb 24, 2026
4ca10bf
code
arthurfiorette Feb 24, 2026
694e056
docs
arthurfiorette Feb 24, 2026
a1e1b4d
code
arthurfiorette Feb 24, 2026
a9f67dc
Patch shikiJs to support custom tsserver plugins
arthurfiorette Feb 24, 2026
22d6ec0
code
arthurfiorette Feb 24, 2026
ec4af87
docs: add kita-dev-workflow skill and improve CONTRIBUTING guide
arthurfiorette Feb 24, 2026
c2c9d88
docs: add TSLangServer debug mode documentation
arthurfiorette Feb 24, 2026
3908bb7
docs: add kita-project-knowledge documentation index skill
arthurfiorette Feb 24, 2026
7233347
update skills
arthurfiorette Feb 24, 2026
4d6fa0e
add fragment safe attr
arthurfiorette Feb 24, 2026
bf6d266
fix double scaped logic
arthurfiorette Feb 24, 2026
2223883
Update error codes to new values
arthurfiorette Feb 24, 2026
ec3aef6
Disable semicolon
arthurfiorette Feb 24, 2026
7e54819
Awesome rspress kita preview plugin
arthurfiorette Feb 25, 2026
165ff66
Attempt to make next publishing work
arthurfiorette Feb 25, 2026
babff1b
code
arthurfiorette Feb 25, 2026
d1dc53c
code
arthurfiorette Feb 25, 2026
cc33bc3
fix changesets
arthurfiorette Feb 25, 2026
79d75ae
install next versions
arthurfiorette Feb 25, 2026
7738234
install @next release
arthurfiorette Feb 25, 2026
ea260c9
Release plan (next) (#470)
github-actions[bot] Mar 12, 2026
6909388
update versions
arthurfiorette Mar 12, 2026
a2cf72e
fix publish
arthurfiorette Mar 12, 2026
a424e9b
finish xss section
arthurfiorette Mar 19, 2026
4aa0b59
chore(deps): bump actions/deploy-pages from 4 to 5 (#478)
dependabot[bot] Apr 2, 2026
628302e
Format files
arthurfiorette Apr 12, 2026
26a6c2f
Upgrade to typescript 6
arthurfiorette Apr 12, 2026
7ebd2ea
fix twoslash ts6
arthurfiorette Apr 12, 2026
aa5848f
d
arthurfiorette Apr 12, 2026
a9ab97c
Add @Kitajs/express-html-plugin
arthurfiorette Apr 12, 2026
e5da2a0
Remove the global `SUSPENSE_ROOT`
arthurfiorette Apr 12, 2026
5547582
fix for SuspenseRoot
arthurfiorette Apr 12, 2026
27ed4c5
fix examples
arthurfiorette Apr 12, 2026
a45a16a
fix express plugin version and improvements on suspense script
arthurfiorette Apr 12, 2026
2652e1b
code
arthurfiorette Apr 13, 2026
ba6dc90
docs
arthurfiorette Apr 13, 2026
60a012d
Release plan (next) (#481)
github-actions[bot] Apr 13, 2026
05ae568
suspense docs
arthurfiorette Apr 13, 2026
dce5bdf
chore(deps): bump actions/cache from 4 to 5 (#469)
dependabot[bot] Apr 13, 2026
134c70d
fix tab
arthurfiorette Apr 13, 2026
230427c
asd
arthurfiorette Apr 13, 2026
426ba98
More docs improvements
arthurfiorette Apr 13, 2026
0a7ee4b
add agent skills
arthurfiorette Apr 13, 2026
7dbe861
Fix rspress theme according to skill
arthurfiorette Apr 13, 2026
3f31091
update contributing guide and claude.md
arthurfiorette Apr 13, 2026
9ab3c03
adds descriptions to all pages
arthurfiorette Apr 13, 2026
6fffefe
initial kita-html skill
arthurfiorette Apr 13, 2026
ac3ecc4
remove skill evals
arthurfiorette Apr 13, 2026
18fada8
remove banner from .md files
arthurfiorette Apr 13, 2026
28b6d25
fix example code
arthurfiorette Apr 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
275 changes: 275 additions & 0 deletions .agents/skills/rspress-custom-theme/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,275 @@
---
name: rspress-custom-theme
description:
Customize Rspress themes using CSS variables, Layout slots, component wrapping, or
component ejection. Use when a user wants to change the look and feel of an Rspress
site, override theme components, add custom navigation/sidebar/footer content, inject
global providers, or modify the default Rspress theme in any way. Also use when a user
mentions theme/index.tsx, Layout slots, BEM class overrides, or rspress eject.
---

# Rspress Custom Theme

Guide for customizing Rspress (v2) themes. Rspress offers four levels of customization,
from lightest to heaviest. Always prefer the lightest approach that meets the requirement
— lighter approaches are more maintainable and survive Rspress upgrades.

## Workflow

1. **Understand the user's goal** — what do they want to change? (colors, layout, inject
content, replace a component entirely?)
2. **Pick the right level** using the decision flow below
3. **Set up `theme/index.tsx`** if needed (Levels 1A, 3, 4 all need it)
4. **Implement** following the patterns in this skill and reference files
5. **Verify** the user's Rspress version is v2 (imports use `@rspress/core/*` not
`rspress/*`)

## Decision Flow

| User wants to... | Level | Approach |
| ---------------------------------------------------------------- | ----- | --------------------------- |
| Change brand colors, fonts, spacing, shadows | 1 | CSS variables |
| Adjust a specific component's style (borders, padding, etc.) | 2 | BEM class overrides |
| Add content around existing components (banners, footers, logos) | 3 | Layout slots (wrap) |
| Override MDX rendering (custom `<h1>`, `<code>`, etc.) | 3 | `components` slot |
| Wrap the app in a provider (state, analytics, auth) | 4 | Eject `Root` |
| Replace built-in icons (logo, GitHub, search, etc.) | — | Icon re-export |
| Completely replace a built-in component | 4 | Eject that component |
| Add a global floating component (back-to-top, chat widget) | — | `globalUIComponents` config |
| Control page layout structure (hide sidebar, blank page) | — | Frontmatter `pageType` |

---

## theme/index.tsx — The Entry Point

Levels 1A, 3, and 4 all require a `theme/index.tsx` file in the project root (sibling to
`docs/`). This is the single entry point for all theme customizations:

```text
project/
├── docs/
├── theme/
│ ├── index.tsx # Theme entry — re-exports + overrides
│ ├── index.css # CSS variable / BEM overrides (optional)
│ └── components/ # Ejected components (Level 4)
└── rspress.config.ts
```

Minimal setup:

```tsx
// theme/index.tsx
import './index.css' // optional
export * from '@rspress/core/theme-original'
```

**Critical import rule**: Inside `theme/` files, always import from
`@rspress/core/theme-original`. The path `@rspress/core/theme` resolves to your own
`theme/index.tsx`, which causes circular imports. (In `docs/` MDX files,
`@rspress/core/theme` is fine — it correctly points to your custom theme.)

---

## Level 1: CSS Variables

Override CSS custom properties for brand colors, backgrounds, text, code blocks, and more.

**Option A** — `theme/index.css` (use when you also have component overrides in
`theme/index.tsx`):

```css
/* theme/index.css */
:root {
--rp-c-brand: #7c3aed;
--rp-c-brand-light: #8b5cf6;
--rp-c-brand-dark: #6d28d9;
}
.dark {
--rp-c-brand: #a78bfa;
}
```

**Option B** — `globalStyles` (use when you only need CSS changes, no component
overrides):

```ts
// rspress.config.ts
export default defineConfig({
globalStyles: path.join(__dirname, 'styles/custom.css')
})
```

> **Full variable list**: Read `references/css-variables.md` for all available CSS
> variables with light/dark defaults.

---

## Level 2: BEM Class Overrides

All built-in components follow BEM naming: `.rp-[component]__[element]--[modifier]`.

Common targets: `.rp-nav`, `.rp-link`, `.rp-tabs`, `.rp-codeblock`,
`.rp-codeblock__title`, `.rp-nav-menu__item--active`.

Use these in your CSS file for targeted style changes when CSS variables aren't granular
enough.

---

## Level 3: Wrap (Layout Slots)

Inject content at specific positions in the layout without replacing built-in components.
Override `Layout` in `theme/index.tsx`:

```tsx
// theme/index.tsx
import { Layout as OriginalLayout } from '@rspress/core/theme-original'
export * from '@rspress/core/theme-original'

export function Layout() {
return <OriginalLayout beforeNavTitle={<MyLogo />} bottom={<CustomFooter />} />
}
```

Use runtime hooks inside slot components — import from `@rspress/core/runtime`:
`useDark()`, `useLang()`, `useVersion()`, `usePage()`, `useSite()`, `useFrontmatter()`,
`useI18n()`.

> **All slots & examples**: Read `references/layout-slots.md` for the complete slot list
> and usage patterns including i18n and MDX component overrides.

---

## Level 4: Eject

Copy a built-in component's source for full replacement. Only use when wrap/slots cannot
achieve the customization.

```bash
rspress eject # list available components
rspress eject DocFooter # eject to theme/components/DocFooter/
```

Then re-export in `theme/index.tsx` (named export takes precedence over the wildcard):

```tsx
export * from '@rspress/core/theme-original'
export { DocFooter } from './components/DocFooter'
```

> **Component list & patterns**: Read `references/eject-components.md` for available
> components, workflow, and common patterns.

---

## Custom Icons

Rspress has 27 built-in icons used across the UI. You can replace any of them by
re-exporting your own icon component with the same name — no ejection needed. This uses
the same `theme/index.tsx` mechanism: your named export takes precedence over the wildcard
re-export.

**Icon type**: Each icon is a React component or a URL string:

```ts
import type { FC, SVGProps } from 'react'
type Icon = FC<SVGProps<SVGSVGElement>> | string
```

**Example 1** — Replace an icon with a custom SVG component:

```tsx
// theme/index.tsx
export * from '@rspress/core/theme-original'

// Named export overrides the wildcard — replaces the GitHub icon site-wide
export const IconGithub = (props: React.SVGProps<SVGSVGElement>) => (
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" {...props}>
<path d="M12 2C6.477 2 2 6.484 2 12.017c0 ..." fill="currentColor" />
</svg>
)
```

**Example 2** — Use an SVGR import:

```tsx
// theme/index.tsx
export * from '@rspress/core/theme-original'

import CustomGithubIcon from './icons/github.svg?react'
export const IconGithub = CustomGithubIcon
```

**Using `SvgWrapper` in MDX or custom components**:

```mdx
import { SvgWrapper, IconGithub } from '@rspress/core/theme'

<SvgWrapper icon={IconGithub} width={24} height={24} />
```

**Available icons**: `IconArrowDown`, `IconArrowRight`, `IconClose`, `IconCopy`,
`IconDeprecated`, `IconDown`, `IconEdit`, `IconEmpty`, `IconExperimental`,
`IconExternalLink`, `IconFile`, `IconGithub`, `IconGitlab`, `IconHeader`, `IconJump`,
`IconLink`, `IconLoading`, `IconMenu`, `IconMoon`, `IconScrollToTop`, `IconSearch`,
`IconSmallMenu`, `IconSuccess`, `IconSun`, `IconTitle`, `IconWrap`, `IconWrapped`.

> **Source**: See the
> [icons source](https://github.com/web-infra-dev/rspress/blob/main/packages/core/src/theme/icons.ts)
> for default implementations.

---

## Global UI Components

For components that should render on every page without theme overrides:

```ts
// rspress.config.ts
export default defineConfig({
globalUIComponents: [
path.join(__dirname, 'components', 'BackToTop.tsx'),
[path.join(__dirname, 'components', 'Analytics.tsx'), { trackingId: '...' }]
]
})
```

---

## Page Types

Control layout per page via frontmatter `pageType`:

| Value | Description |
| ---------- | ------------------------------------- |
| `home` | Home page with navbar |
| `doc` | Standard doc with sidebar and outline |
| `doc-wide` | Doc without sidebar/outline |
| `custom` | Custom content with navbar only |
| `blank` | Custom content without navbar |
| `404` | 404 error page |

Fine-grained: set `navbar: false`, `sidebar: false`, `outline: false`, `footer: false`
individually.

---

## Common Pitfalls

- **Circular import**: Using `@rspress/core/theme` instead of
`@rspress/core/theme-original` in `theme/` files — causes infinite loop.
- **Eject over-use**: Ejecting when a Layout slot or CSS variable would suffice — creates
upgrade burden.
- **Missing re-export**: Forgetting `export * from '@rspress/core/theme-original'` in
`theme/index.tsx` — breaks all un-overridden components.
- **v1 imports**: Using `rspress/theme` or `@rspress/theme-default` — these are v1 paths.
v2 uses `@rspress/core/theme-original`.

## Reference

- Custom theme guide: <https://rspress.rs/guide/basic/custom-theme>
- CSS variables: <https://rspress.rs/ui/vars>
- Layout component: <https://rspress.rs/ui/layout-components/layout>
- Built-in icons: <https://rspress.rs/ui/icons/>
- Built-in hooks: <https://rspress.rs/ui/hooks/>
- CLI commands (eject): <https://rspress.rs/api/commands>
Loading
Loading