Rspress
repository·main·Indexed 11 days ago
https://github.com/web-infra-dev/rspressA high-performance static site generator based on Rsbuild, designed for fast development and deployment of MDX-based documentation and content-heavy websites. It includes a CLI for scaffolding, building, and previewing sites, as well as official plugins for API doc generation (@rspress/plugin-api-docgen), TypeDoc integration (@rspress/plugin-typedoc), RSS feeds, sitemaps, and interactive playgrounds.
What's inside Rspress
- @rspress/plugin-api-docgen is an official Rspress plugin designed to automatically generate API documentation. It integrates with Rspress to streamline the process of creating and maintaining API docs from source code.
Overview of Rspress built-in layout components
mainRspress provides built-in layout components that can be used to structure your documentation site. These include the default homepage layout and the standard Overview page layout. These components are primarily used when building custom themes.What is Rspress 2.0
mainRspress is a static site generator (SSG) built on Rsbuild, specifically designed as a documentation site tool for developers.
Version 2.0 introduces several major improvements over 1.x:
- Enhanced Theme Styling: A new default theme and improved APIs for custom themes.
- AI-native Capabilities: Built-in
llms.txtgeneration and SSG-MD (Static Site Generation for Markdown) to provide high-quality content for AI Agents. - Instant Startup: Uses
lazyCompilationby default, building only required files for visited routes to ensure fast startup regardless of project size. - Shiki Code Highlighting: Integrated by default for build-time syntax highlighting with theme switching support.
- Improved DX (Developer Experience): Optimized HMR for configuration files (
_nav.json,_meta.json), dead link checking, and improved JSON schema support for IDE hints.
What is @rspress/core
mainRspress is a fast static site generator built on top of Rsbuild. It is designed for creating high-performance documentation websites and content-heavy sites.What is Rspress
mainRspress is a high-performance, React-based static site generator (SSG) built on top of Rsbuild. It is designed for building documentation sites, blogs, or product homepages.
Key features include:
- Millisecond-level startup performance.
- AI-native SSG-MD capabilities.
- Full MDX support.
- Built-in full-text search.
- Internationalization (i18n) and multi-version documentation support.
- A default documentation theme that can be customized.
Overview of Rspress features
mainRspress is a lightning-fast Static Site Generator (SSG) built on the Rust-powered front-end toolchain (Rsbuild). Key features include:
- Blazing fast build speed: Leverages Rust-powered tools for a high-performance development experience.
- MDX Support: Allows you to use React components directly within your Markdown content.
- Built-in full-text search: Automatically generates a search index during the build process for out-of-the-box search capabilities.
- AI-friendly: Supports generating
llms.txt-compliant indexes and Markdown files via SSG-MD to help Large Language Models (LLMs) better understand your documentation. - Static Site Generation: Produces static HTML files suitable for deployment on any hosting provider.
- Flexible customization: Provides extension APIs to customize both the theme UI and the build process.
Use @rspress/plugin-typedoc for TypeDoc integration
mainThe@rspress/plugin-typedocplugin provides integration for TypeDoc within Rspress, allowing you to automatically generate API documentation from your TypeScript source code.Compare Rspress with other SSG frameworks
mainRspress is a high-performance static site generator (SSG) based on Rsbuild. When choosing between Rspress and other popular frameworks, consider these key differentiators:
Rspress vs. Docusaurus
- Performance: Rspress uses
lazyCompilationand persistent cache to achieve millisecond-level cold starts. - Complexity: Rspress offers a lower learning curve with simpler configuration and built-in features like search and multi-version docs.
- Abstraction: Rspress provides a higher-level abstraction over the bundler. Instead of managing complex bundler plugins (like
html-webpack-plugin), you can use user-friendly options likebuilderConfig.html.tagsto add tags to the<head>.
Rspress vs. Nextra
- Performance: Rspress provides better build performance.
- Deployment: Rspress is lighter and produces pure HTML, making it suitable for deployment as a pure static site. Nextra is tied to Next.js and includes Next.js runtime code, which often requires deployment as an application using
next start.
Rspress vs. VitePress
- Rendering Framework: Rspress uses React, whereas VitePress uses Vue.
- Content Format: Rspress uses MDX, while VitePress uses Markdown with Vue component support.
- Production Build: While both have fast development starts, Rspress is faster during the production bundling phase compared to VitePress (which uses Rollup).
- Performance: Rspress uses
Understand the Rspress project structure
mainWhen using a project scaffolded by
create-rspress, the following directory structure is used:docs/: The source directory for your documentation. This is defined by therootkey inrspress.config.ts.docs/_nav.json: Configuration file for the navigation bar.docs/[section]/_meta.json: Configuration file for the sidebar within a specific section (e.g.,docs/guide/_meta.json).docs/public/: Directory for static assets.theme/: An optional directory for custom themes (only present if the custom theme scaffold was selected).rspress.config.ts: The main configuration file for Rspress.
Explore official Rspress plugins
mainRspress provides a suite of official plugins to extend the functionality of your documentation site. These plugins cover search, API documentation generation, SEO, interactive playgrounds, and more.
Available Official Plugins:
- Search:
@rspress/plugin-algoliareplaces built-in search with Algolia-based DocSearch. - API Documentation:
@rspress/plugin-api-docgen: Automatically generates API reference content usingreact-docgen-typescriptanddocumentation.@rspress/plugin-typedoc: Automatically generates API documentation for TypeScript modules usingTypeDoc.
- SEO & Discovery:
@rspress/plugin-sitemap: Automatically generates a sitemap for search engine crawling.@rspress/plugin-rss: Generates RSS files usingfeed.@rspress/plugin-llms: Generatesllms.txtfiles to help Large Language Models understand your documentation.
- Interactive Code & Previews:
@rspress/plugin-playground: Provides a real-time playground for Markdown/MDX code blocks.@rspress/plugin-preview: Enables previewing of Markdown/MDX code blocks.@rspress/plugin-twoslash: IntegratesTwoslashto generate rich code blocks with type information.
- Navigation:
@rspress/plugin-client-redirects: Adds client-side redirects to your site.
- Search:
Use @rspress/plugin-preview
mainThe@rspress/plugin-previewis an official Rspress plugin that provides preview functionality for your documentation site. For detailed configuration and usage instructions, refer to the official Rspress documentation.Use the @rspress/plugin-playground plugin
mainThe@rspress/plugin-playgroundplugin provides a playground feature for Rspress sites, allowing users to interact with code examples directly within your documentation. This enables live editing and previewing of code snippets in a sandboxed environment.