What's Changed
Breaking Changes 🚨 and highlights ⭐️
Upgrade shiki V3 and use shiki transformers
related PR: #1672
import { defineConfig } from 'rspress/config';
import { pluginShiki, createTransformerDiff } from '@rspress/plugin-shiki';
+ import {
+ transformerNotationDiff,
+ transformerNotationErrorLevel,
+ transformerNotationFocus,
+ transformerNotationHighlight,
+ } from '@shikijs/transformers';
export default defineConfig({
plugins: [
pluginShiki({
transformers: [
// add as needed
- createTransformerDiff(),
- // createTransformerLineNumber(),
- // createTransformerErrorLevel(),
- // createTransformerHighlight(),
- // createTransformerFocus(),
+ createTransformerLineNumber(),
+ // transformerNotationDiff(),
+ // transformerNotationErrorLevel(),
+ // transformerNotationHighlight(),
+ // transformerNotationFocus(),
],
}),
],
});
Support algolia search by "@rspress/plugin-algolia"
related PR: #1909
Installation
npm add @rspress/plugin-algolia -D
Usage
First, add the following configuration to your config file:
// rspress.config.ts
import path from 'path';
import { defineConfig } from 'rspress';
import { pluginAlgolia } from '@rspress/plugin-algolia';
export default defineConfig({
plugins: [pluginAlgolia()],
});
// theme/index.tsx
import { Search as PluginAlgoliaSearch } from '@rspress/plugin-algolia/runtime';
const Search = () => {
return (
<PluginAlgoliaSearch
docSearchProps={{
appId: 'R2IYF7ETH7', // Replace with your own Algolia appId
apiKey: '599cec31baffa4868cae4e79f180729b', // Replace with your own Algolia apiKey
indexName: 'docsearch', // Replace with your own Algolia indexName
}}
/>
);
};
export { Search };
export * from 'rspress/theme';
Builtin Sass and Less plugins removed
related PR: #1937
Rspress 2.0 no longer has Rsbuild's Less and Sass plugins built into it. You can manually install and register plugins to support Sass and Less.
- Sass:
// rspress.config.ts
import { defineConfig } from 'rspress/config';
import { pluginSass } from '@rsbuild/plugin-sass';
export default defineConfig({
builderPlugins: [pluginSass()],
});
- Less:
// rspress.config.ts
import { defineConfig } from 'rspress/config';
import { pluginLess } from '@rsbuild/plugin-less';
export default defineConfig({
builderPlugins: [pluginLess()],
});
New Features 🎉
- feat!(plugin-shiki): bump shiki to v3, migrate to official transformers by @JounQin in #1672
- feat: expose builder preview result for programming usage by @JounQin in #1944
- feat(plugin-algolia): add plugin-algolia and optimize some DX on customizing Search by @SoonIter in #1909
Bug Fixes 🐞
- fix: remove async fs to avoid empty global style by @SoonIter in #1934
- fix: rework sidebar menu responsive issues by @JounQin in #1928
- fix(cli): should catch build errors by @chenjiahan in #1938
- fix(mdxjs): not need to add base on normalizing links with base enabled by @JounQin in #1943
- fix!: remove the builtin Sass and Less plugins by @chenjiahan in #1937
- fix(core): memfs should be dev dependency by @chenjiahan in #1946
- fix(theme): unset overflow style when sidebar destroy by @quanquan2100 in #1949
- fix: failed to update search index after switching lang by @chenjiahan in #1950
Other Changes
- chore(theme): replace with <></>, rename
SideMenu
toSidebarMenu
by @SoonIter in #1932 - Release v2.0.0-alpha.2 by @SoonIter in #1947
New Contributors
- @quanquan2100 made their first contribution in #1949
Full Changelog: v2.0.0-alpha.1...v2.0.0-alpha.2