For AI agents: the complete documentation index is available at https://rspress.rs/llms.txt, the full documentation bundle is available at https://rspress.rs/llms-full.txt, and this page is available as Markdown at https://rspress.rs/ui/components/source-code.md.
close
  • English
  • SourceCode

    SourceCode renders a link to repository source code.

    Usage

    index.mdx
    import { SourceCode } from '@rspress/core/theme';
    
    <SourceCode href="https://github.com/web-infra-dev/rspress/blob/main/packages/theme-default/src/components/SourceCode/index.tsx" />

    Props

    interface SourceCodeProps {
      /** Source code link */
      href: string;
      /** Code hosting platform, determines which icon to display */
      platform?: 'github' | 'gitlab';
    }

    Use platform to switch the icon between GitHub and GitLab. Defaults to 'github'.