RsbuildConfig
Used to customize the configurations of Rsbuild. For detailed configurations, please refer to Rsbuild - Config.
For example, change the output directory to doc_dist
:
RsbuildPlugin[]
Used to register Rsbuild plugins.
You can use the rich plugins of Rsbuild in the Rspress project to quickly extend the building capabilities.
If you need to view the default Rspack or Rsbuild configs, you can add the DEBUG=rsbuild
parameter when running the rspress dev
or rspress build
command:
After execution, the rsbuild.config.js
file is created in the doc_build
directory, which contains the complete builderConfig
.
Please refer to Rsbuild - Debug Mode for more information on how to debug the Rsbuild.
Object
Configure MDX-related compilation abilities.
Array
[]
Configure the remark plugins. for example:
Array
Configure the rehype plugin. for example:
boolean
false
Whether to check for dead links. for example:
After enabling this config, the framework will check the links in the document based on the conventional routing table. If there is an unreachable link, the build will throw an error and exit.
Type: boolean | { include: (filepath: string) => boolean }
Default: true
Whether to use the Rust version of the MDX compiler. For example:
You can also provide a function to determine which files use the Rust version of MDX compiler. For example:
The bottom layer of mdxRs
is based on the @rspress/mdx-rs-binding library developed by Rspress. The performance is 10+ times higher than the JS version of the MDX compiler, but the JS version of the plugin is not yet supported.
boolean
Whether to display the line number of the code block. Defaults to false
.
boolean
Whether to enable long code line wrapping display by default. Defaults to false
.
string[]
Register component to the global scope, which will make it automatically available in every MDX file, without any import statements.For example:
Then you can use the Alert
component in any MDX file:
Please set markdown.mdxRs
to false
when configuring globalComponents
, otherwise the global components will not take effect.
(string | [string, string])[]
Register the language needed for code highlighting.
js
, jsx
, ts
, tsx
, json
, css
, scss
, less
, html
, xml
, diff
, yaml
, md
, mdx
, and bash
.Rspress does not register all supported languages by default in order to reduce the bundle size of the build output. You can extend on these default languages, for example:
Each language config supports both string
and [string, string]
formats. In the array format, the former is the alias of the language, and the latter is the full name of the language. You can go to the file list to view all supported language full names.