github web-infra-dev/rspress v2.0.0-beta.8

latest releases: v2.0.2, v2.0.1, v2.0.0...
pre-release8 months ago

Highlights✨

Add <CodeBlockRuntime /> component for dynamic code block highlighting

related PR: #2190, #2206

This is an escape hatch, which can be used for dynamic code block highlighting when the shiki highlighting at compile time does not meet your needs.

import { CodeBlockRuntime } from '@theme';
import { transformerNotationHighlight } from '@shikijs/transformers';

<CodeBlockRuntime
  lang="ts"
  title="highlight.ts"
  code={`console.log('Highlighted'); // [!code highlight]
// [!code highlight:1]
console.log('Highlighted');
console.log('Not highlighted');`}
  shikiOptions={{
    transformers: [transformerNotationHighlight()],
  }}
/>

What's Changed

New Features 🎉

  • feat: enable rehype-raw plugin by default by @JounQin in #2199
  • feat(CodeBlockRuntime): add shikiOptions prop by @SoonIter in #2208
  • feat(plugin-shiki): add @rspress/plugin-shiki/transformers exports and transformerCompatibleMetaHighlight by @SoonIter in #2209
  • feat(CodeBlockRuntime): add onRendered prop by @SoonIter in #2211

Bug Fixes 🐞

  • fix(CodeBlockRuntime): CodeBlockRuntime should render the same dom structure with compile-time code block by @SoonIter in #2206

Other Changes

Full Changelog: v2.0.0-beta.7...v2.0.0-beta.8

Don't miss a new rspress release

NewReleases is sending notifications on new releases.