github web-infra-dev/rspress v2.0.0-alpha.2

pre-release19 hours ago

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 🐞

Other Changes

New Contributors

Full Changelog: v2.0.0-alpha.1...v2.0.0-alpha.2

Don't miss a new rspress release

NewReleases is sending notifications on new releases.