🚧 Rspress 2.0 文档还在开发中
close

SourceCode

SourceCode 用于渲染仓库源码的链接。

用法

index.mdx
import { SourceCode } from '@theme';

<SourceCode href="https://github.com/web-infra-dev/rspress/blob/main/packages/theme-default/src/components/SourceCode/index.tsx" />;

Props

interface SourceCodeProps {
  /** 源码链接 */
  href: string;
  /** 代码托管平台,决定显示的图标 */
  platform?: 'github' | 'gitlab';
}

通过 platform 切换 GitHub/GitLab 图标,默认为 'github'